home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / gcc263-src.lha / gcc-2.6.3 / toplev.c < prev    next >
C/C++ Source or Header  |  1994-10-25  |  106KB  |  4,080 lines

  1. /* Top level of GNU C compiler
  2.    Copyright (C) 1987, 88, 89, 92, 93, 1994 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20.  
  21. /* This is the top level of cc1/c++.
  22.    It parses command args, opens files, invokes the various passes
  23.    in the proper order, and counts the time used by each.
  24.    Error messages and low-level interface to malloc also handled here.  */
  25.  
  26. #include "config.h"
  27. #ifdef __STDC__
  28. #include <stdarg.h>
  29. #else
  30. #include <varargs.h>
  31. #endif
  32. #include <stdio.h>
  33. #include <signal.h>
  34. #include <setjmp.h>
  35. #include <sys/types.h>
  36. #include <ctype.h>
  37. #include <sys/stat.h>
  38.  
  39. #ifndef WINNT
  40. #ifdef USG
  41. #undef FLOAT
  42. #include <sys/param.h>
  43. /* This is for hpux.  It is a real screw.  They should change hpux.  */
  44. #undef FLOAT
  45. #include <sys/times.h>
  46. #include <time.h>   /* Correct for hpux at least.  Is it good on other USG?  */
  47. #undef FFS  /* Some systems define this in param.h.  */
  48. #else
  49. #ifndef VMS
  50. #include <sys/time.h>
  51. #include <sys/resource.h>
  52. #endif
  53. #endif
  54. #endif
  55.  
  56. #include "input.h"
  57. #include "tree.h"
  58. /* #include "c-tree.h" */
  59. #include "rtl.h"
  60. #include "flags.h"
  61. #include "insn-attr.h"
  62. #include "defaults.h"
  63.  
  64. #ifdef XCOFF_DEBUGGING_INFO
  65. #include "xcoffout.h"
  66. #endif
  67.  
  68. #include "bytecode.h"
  69. #include "bc-emit.h"
  70.  
  71. #ifdef VMS
  72. /* The extra parameters substantially improve the I/O performance.  */
  73. static FILE *
  74. VMS_fopen (fname, type)
  75.      char * fname;
  76.      char * type;
  77. {
  78.   if (strcmp (type, "w") == 0)
  79.     return fopen (fname, type, "mbc=16", "deq=64", "fop=tef", "shr=nil");
  80.   return fopen (fname, type, "mbc=16");
  81. }
  82. #define fopen VMS_fopen
  83. #endif
  84.  
  85. #ifndef DEFAULT_GDB_EXTENSIONS
  86. #define DEFAULT_GDB_EXTENSIONS 1
  87. #endif
  88.  
  89. extern int rtx_equal_function_value_matters;
  90.  
  91. #if ! (defined (VMS) || defined (OS2))
  92. extern char **environ;
  93. #endif
  94. extern char *version_string, *language_string;
  95.  
  96. /* Carry information from ASM_DECLARE_OBJECT_NAME
  97.    to ASM_FINISH_DECLARE_OBJECT.  */
  98.  
  99. extern int size_directive_output;
  100. extern tree last_assemble_variable_decl;
  101.  
  102. extern void init_lex ();
  103. extern void init_decl_processing ();
  104. extern void init_obstacks ();
  105. extern void init_tree_codes ();
  106. extern void init_rtl ();
  107. extern void init_regs ();
  108. extern void init_optabs ();
  109. extern void init_stmt ();
  110. extern void init_reg_sets ();
  111. extern void dump_flow_info ();
  112. extern void dump_sched_info ();
  113. extern void dump_local_alloc ();
  114.  
  115. void rest_of_decl_compilation ();
  116. void error_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
  117. void error_with_decl PVPROTO((tree decl, char *s, ...));
  118. void error_for_asm PVPROTO((rtx insn, char *s, ...));
  119. void error PVPROTO((char *s, ...));
  120. void fatal PVPROTO((char *s, ...));
  121. void warning_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
  122. void warning_with_decl PVPROTO((tree decl, char *s, ...));
  123. void warning_for_asm PVPROTO((rtx insn, char *s, ...));
  124. void warning PVPROTO((char *s, ...));
  125. void pedwarn PVPROTO((char *s, ...));
  126. void pedwarn_with_decl PVPROTO((tree decl, char *s, ...));
  127. void pedwarn_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
  128. void sorry PVPROTO((char *s, ...));
  129. void really_sorry PVPROTO((char *s, ...));
  130. void fancy_abort ();
  131. #ifndef abort
  132. void abort ();
  133. #endif
  134. void set_target_switch ();
  135. static void print_switch_values ();
  136. static char *decl_name ();
  137.  
  138. /* Name of program invoked, sans directories.  */
  139.  
  140. char *progname;
  141.  
  142. /* Copy of arguments to main.  */
  143. int save_argc;
  144. char **save_argv;
  145.  
  146. /* Name of current original source file (what was input to cpp).
  147.    This comes from each #-command in the actual input.  */
  148.  
  149. char *input_filename;
  150.  
  151. /* Name of top-level original source file (what was input to cpp).
  152.    This comes from the #-command at the beginning of the actual input.
  153.    If there isn't any there, then this is the cc1 input file name.  */
  154.  
  155. char *main_input_filename;
  156.  
  157. /* Stream for reading from the input file.  */
  158.  
  159. FILE *finput;
  160.  
  161. /* Current line number in real source file.  */
  162.  
  163. int lineno;
  164.  
  165. /* Stack of currently pending input files.  */
  166.  
  167. struct file_stack *input_file_stack;
  168.  
  169. /* Incremented on each change to input_file_stack.  */
  170. int input_file_stack_tick;
  171.  
  172. /* FUNCTION_DECL for function now being parsed or compiled.  */
  173.  
  174. extern tree current_function_decl;
  175.  
  176. /* Name to use as base of names for dump output files.  */
  177.  
  178. char *dump_base_name;
  179.  
  180. /* Bit flags that specify the machine subtype we are compiling for.
  181.    Bits are tested using macros TARGET_... defined in the tm.h file
  182.    and set by `-m...' switches.  Must be defined in rtlanal.c.  */
  183.  
  184. extern int target_flags;
  185.  
  186. /* Flags saying which kinds of debugging dump have been requested.  */
  187.  
  188. int rtl_dump = 0;
  189. int rtl_dump_and_exit = 0;
  190. int jump_opt_dump = 0;
  191. int cse_dump = 0;
  192. int loop_dump = 0;
  193. int cse2_dump = 0;
  194. int flow_dump = 0;
  195. int combine_dump = 0;
  196. int sched_dump = 0;
  197. int local_reg_dump = 0;
  198. int global_reg_dump = 0;
  199. int sched2_dump = 0;
  200. int jump2_opt_dump = 0;
  201. int dbr_sched_dump = 0;
  202. int flag_print_asm_name = 0;
  203. int stack_reg_dump = 0;
  204.  
  205. /* Name for output file of assembly code, specified with -o.  */
  206.  
  207. char *asm_file_name;
  208.  
  209. /* Value of the -G xx switch, and whether it was passed or not.  */
  210. int g_switch_value;
  211. int g_switch_set;
  212.  
  213. /* Type(s) of debugging information we are producing (if any).
  214.    See flags.h for the definitions of the different possible
  215.    types of debugging information.  */
  216. enum debug_info_type write_symbols = NO_DEBUG;
  217.  
  218. /* Level of debugging information we are producing.  See flags.h
  219.    for the definitions of the different possible levels.  */
  220. enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
  221.  
  222. /* Nonzero means use GNU-only extensions in the generated symbolic
  223.    debugging information.  */
  224. /* Currently, this only has an effect when write_symbols is set to
  225.    DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG.  */
  226. int use_gnu_debug_info_extensions = 0;
  227.  
  228. /* Nonzero means do optimizations.  -O.
  229.    Particular numeric values stand for particular amounts of optimization;
  230.    thus, -O2 stores 2 here.  However, the optimizations beyond the basic
  231.    ones are not controlled directly by this variable.  Instead, they are
  232.    controlled by individual `flag_...' variables that are defaulted
  233.    based on this variable.  */
  234.  
  235. int optimize = 0;
  236.  
  237. /* Number of error messages and warning messages so far.  */
  238.  
  239. int errorcount = 0;
  240. int warningcount = 0;
  241. int sorrycount = 0;
  242.  
  243. /* Flag to output bytecode instead of native assembler */
  244. int output_bytecode = 0;
  245.  
  246. /* Pointer to function to compute the name to use to print a declaration.  */
  247.  
  248. char *(*decl_printable_name) ();
  249.  
  250. /* Pointer to function to compute rtl for a language-specific tree code.  */
  251.  
  252. struct rtx_def *(*lang_expand_expr) ();
  253.  
  254. /* Pointer to function to finish handling an incomplete decl at the
  255.    end of compilation.  */
  256.  
  257. void (*incomplete_decl_finalize_hook) () = 0;
  258.  
  259. /* Pointer to function for interim exception handling implementation.
  260.    This interface will change, and it is only here until a better interface
  261.    replaces it.  */
  262.  
  263. void (*interim_eh_hook)    PROTO((tree));
  264.  
  265. /* Nonzero if generating code to do profiling.  */
  266.  
  267. int profile_flag = 0;
  268.  
  269. /* Nonzero if generating code to do profiling on a line-by-line basis.  */
  270.  
  271. int profile_block_flag;
  272.  
  273. /* Nonzero for -pedantic switch: warn about anything
  274.    that standard spec forbids.  */
  275.  
  276. int pedantic = 0;
  277.  
  278. /* Temporarily suppress certain warnings.
  279.    This is set while reading code from a system header file.  */
  280.  
  281. int in_system_header = 0;
  282.  
  283. /* Nonzero means do stupid register allocation.
  284.    Currently, this is 1 if `optimize' is 0.  */
  285.  
  286. int obey_regdecls = 0;
  287.  
  288. /* Don't print functions as they are compiled and don't print
  289.    times taken by the various passes.  -quiet.  */
  290.  
  291. int quiet_flag = 0;
  292.  
  293. /* -f flags.  */
  294.  
  295. /* Nonzero means `char' should be signed.  */
  296.  
  297. int flag_signed_char;
  298.  
  299. /* Nonzero means give an enum type only as many bytes as it needs.  */
  300.  
  301. int flag_short_enums;
  302.  
  303. /* Nonzero for -fcaller-saves: allocate values in regs that need to
  304.    be saved across function calls, if that produces overall better code.
  305.    Optional now, so people can test it.  */
  306.  
  307. #ifdef DEFAULT_CALLER_SAVES
  308. int flag_caller_saves = 1;
  309. #else
  310. int flag_caller_saves = 0;
  311. #endif
  312.  
  313. /* Nonzero if structures and unions should be returned in memory.
  314.  
  315.    This should only be defined if compatibility with another compiler or
  316.    with an ABI is needed, because it results in slower code.  */
  317.  
  318. #ifndef DEFAULT_PCC_STRUCT_RETURN
  319. #define DEFAULT_PCC_STRUCT_RETURN 1
  320. #endif
  321.  
  322. /* Nonzero for -fpcc-struct-return: return values the same way PCC does.  */
  323.  
  324. int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
  325.  
  326. /* Nonzero for -fforce-mem: load memory value into a register
  327.    before arithmetic on it.  This makes better cse but slower compilation.  */
  328.  
  329. int flag_force_mem = 0;
  330.  
  331. /* Nonzero for -fforce-addr: load memory address into a register before
  332.    reference to memory.  This makes better cse but slower compilation.  */
  333.  
  334. int flag_force_addr = 0;
  335.  
  336. /* Nonzero for -fdefer-pop: don't pop args after each function call;
  337.    instead save them up to pop many calls' args with one insns.  */
  338.  
  339. int flag_defer_pop = 0;
  340.  
  341. /* Nonzero for -ffloat-store: don't allocate floats and doubles
  342.    in extended-precision registers.  */
  343.  
  344. int flag_float_store = 0;
  345.  
  346. /* Nonzero for -fcse-follow-jumps:
  347.    have cse follow jumps to do a more extensive job.  */
  348.  
  349. int flag_cse_follow_jumps;
  350.  
  351. /* Nonzero for -fcse-skip-blocks:
  352.    have cse follow a branch around a block.  */
  353. int flag_cse_skip_blocks;
  354.  
  355. /* Nonzero for -fexpensive-optimizations:
  356.    perform miscellaneous relatively-expensive optimizations.  */
  357. int flag_expensive_optimizations;
  358.  
  359. /* Nonzero for -fthread-jumps:
  360.    have jump optimize output of loop.  */
  361.  
  362. int flag_thread_jumps;
  363.  
  364. /* Nonzero enables strength-reduction in loop.c.  */
  365.  
  366. int flag_strength_reduce = 0;
  367.  
  368. /* Nonzero enables loop unrolling in unroll.c.  Only loops for which the
  369.    number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
  370.    UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
  371.    unrolled.  */
  372.  
  373. int flag_unroll_loops;
  374.  
  375. /* Nonzero enables loop unrolling in unroll.c.  All loops are unrolled.
  376.    This is generally not a win.  */
  377.  
  378. int flag_unroll_all_loops;
  379.  
  380. /* Nonzero for -fwritable-strings:
  381.    store string constants in data segment and don't uniquize them.  */
  382.  
  383. int flag_writable_strings = 0;
  384.  
  385. /* Nonzero means don't put addresses of constant functions in registers.
  386.    Used for compiling the Unix kernel, where strange substitutions are
  387.    done on the assembly output.  */
  388.  
  389. int flag_no_function_cse = 0;
  390.  
  391. /* Nonzero for -fomit-frame-pointer:
  392.    don't make a frame pointer in simple functions that don't require one.  */
  393.  
  394. int flag_omit_frame_pointer = 0;
  395.  
  396. /* Nonzero to inhibit use of define_optimization peephole opts.  */
  397.  
  398. int flag_no_peephole = 0;
  399.  
  400. /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
  401.    operations in the interest of optimization.  For example it allows
  402.    GCC to assume arguments to sqrt are nonnegative numbers, allowing
  403.    faster code for sqrt to be generated. */
  404.  
  405. int flag_fast_math = 0;
  406.  
  407. /* Nonzero means all references through pointers are volatile.  */
  408.  
  409. int flag_volatile;
  410.  
  411. /* Nonzero means treat all global and extern variables as global.  */
  412.  
  413. int flag_volatile_global;
  414.  
  415. /* Nonzero means just do syntax checking; don't output anything.  */
  416.  
  417. int flag_syntax_only = 0;
  418.  
  419. /* Nonzero means to rerun cse after loop optimization.  This increases
  420.    compilation time about 20% and picks up a few more common expressions.  */
  421.  
  422. static int flag_rerun_cse_after_loop;
  423.  
  424. /* Nonzero for -finline-functions: ok to inline functions that look like
  425.    good inline candidates.  */
  426.  
  427. int flag_inline_functions;
  428.  
  429. /* Nonzero for -fkeep-inline-functions: even if we make a function
  430.    go inline everywhere, keep its definition around for debugging
  431.    purposes.  */
  432.  
  433. int flag_keep_inline_functions;
  434.  
  435. /* Nonzero means that functions will not be inlined.  */
  436.  
  437. int flag_no_inline;
  438.  
  439. /* Nonzero means we should be saving declaration info into a .X file.  */
  440.  
  441. int flag_gen_aux_info = 0;
  442.  
  443. /* Specified name of aux-info file.  */
  444.  
  445. static char *aux_info_file_name;
  446.  
  447. /* Nonzero means make the text shared if supported.  */
  448.  
  449. int flag_shared_data;
  450.  
  451. /* Nonzero means schedule into delayed branch slots if supported.  */
  452.  
  453. int flag_delayed_branch;
  454.  
  455. /* Nonzero means to run cleanups after CALL_EXPRs.  */
  456.  
  457. int flag_short_temps;
  458.  
  459. /* Nonzero if we are compiling pure (sharable) code.
  460.    Value is 1 if we are doing reasonable (i.e. simple
  461.    offset into offset table) pic.  Value is 2 if we can
  462.    only perform register offsets.  */
  463.  
  464. int flag_pic;
  465.  
  466. /* Nonzero means place uninitialized global data in the bss section. */
  467.  
  468. int flag_no_common;
  469.  
  470. /* Nonzero means pretend it is OK to examine bits of target floats,
  471.    even if that isn't true.  The resulting code will have incorrect constants,
  472.    but the same series of instructions that the native compiler would make.  */
  473.  
  474. int flag_pretend_float;
  475.  
  476. /* Nonzero means change certain warnings into errors.
  477.    Usually these are warnings about failure to conform to some standard.  */
  478.  
  479. int flag_pedantic_errors = 0;
  480.  
  481. /* flag_schedule_insns means schedule insns within basic blocks (before
  482.    local_alloc).
  483.    flag_schedule_insns_after_reload means schedule insns after
  484.    global_alloc.  */
  485.  
  486. int flag_schedule_insns = 0;
  487. int flag_schedule_insns_after_reload = 0;
  488.  
  489. /* -finhibit-size-directive inhibits output of .size for ELF.
  490.    This is used only for compiling crtstuff.c, 
  491.    and it may be extended to other effects
  492.    needed for crtstuff.c on other systems.  */
  493. int flag_inhibit_size_directive = 0;
  494.  
  495. /* -fverbose-asm causes extra commentary information to be produced in
  496.    the generated assembly code (to make it more readable).  This option
  497.    is generally only of use to those who actually need to read the
  498.    generated assembly code (perhaps while debugging the compiler itself).  */
  499.  
  500. int flag_verbose_asm = 0;
  501.  
  502. /* -fgnu-linker specifies use of the GNU linker for initializations.
  503.    (Or, more generally, a linker that handles initializations.)
  504.    -fno-gnu-linker says that collect2 will be used.  */
  505. #ifdef USE_COLLECT2
  506. int flag_gnu_linker = 0;
  507. #else
  508. int flag_gnu_linker = 1;
  509. #endif
  510.  
  511. /* Table of language-independent -f options.
  512.    STRING is the option name.  VARIABLE is the address of the variable.
  513.    ON_VALUE is the value to store in VARIABLE
  514.     if `-fSTRING' is seen as an option.
  515.    (If `-fno-STRING' is seen as an option, the opposite value is stored.)  */
  516.  
  517. struct { char *string; int *variable; int on_value;} f_options[] =
  518. {
  519.   {"float-store", &flag_float_store, 1},
  520.   {"volatile", &flag_volatile, 1},
  521.   {"volatile-global", &flag_volatile_global, 1},
  522.   {"defer-pop", &flag_defer_pop, 1},
  523.   {"omit-frame-pointer", &flag_omit_frame_pointer, 1},
  524.   {"cse-follow-jumps", &flag_cse_follow_jumps, 1},
  525.   {"cse-skip-blocks", &flag_cse_skip_blocks, 1},
  526.   {"expensive-optimizations", &flag_expensive_optimizations, 1},
  527.   {"thread-jumps", &flag_thread_jumps, 1},
  528.   {"strength-reduce", &flag_strength_reduce, 1},
  529.   {"unroll-loops", &flag_unroll_loops, 1},
  530.   {"unroll-all-loops", &flag_unroll_all_loops, 1},
  531.   {"writable-strings", &flag_writable_strings, 1},
  532.   {"peephole", &flag_no_peephole, 0},
  533.   {"force-mem", &flag_force_mem, 1},
  534.   {"force-addr", &flag_force_addr, 1},
  535.   {"function-cse", &flag_no_function_cse, 0},
  536.   {"inline-functions", &flag_inline_functions, 1},
  537.   {"keep-inline-functions", &flag_keep_inline_functions, 1},
  538.   {"inline", &flag_no_inline, 0},
  539.   {"syntax-only", &flag_syntax_only, 1},
  540.   {"shared-data", &flag_shared_data, 1},
  541.   {"caller-saves", &flag_caller_saves, 1},
  542.   {"pcc-struct-return", &flag_pcc_struct_return, 1},
  543.   {"reg-struct-return", &flag_pcc_struct_return, 0},
  544.   {"delayed-branch", &flag_delayed_branch, 1},
  545.   {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1},
  546.   {"pretend-float", &flag_pretend_float, 1},
  547.   {"schedule-insns", &flag_schedule_insns, 1},
  548.   {"schedule-insns2", &flag_schedule_insns_after_reload, 1},
  549.   {"pic", &flag_pic, 1},
  550.   {"PIC", &flag_pic, 2},
  551.   {"fast-math", &flag_fast_math, 1},
  552.   {"common", &flag_no_common, 0},
  553.   {"inhibit-size-directive", &flag_inhibit_size_directive, 1},
  554.   {"verbose-asm", &flag_verbose_asm, 1},
  555.   {"gnu-linker", &flag_gnu_linker, 1},
  556.   {"bytecode", &output_bytecode, 1}
  557. };
  558.  
  559. /* Table of language-specific options.  */
  560.  
  561. char *lang_options[] =
  562. {
  563.   "-ansi",
  564.   "-fallow-single-precision",
  565.  
  566.   "-fsigned-bitfields",
  567.   "-funsigned-bitfields",
  568.   "-fno-signed-bitfields",
  569.   "-fno-unsigned-bitfields",
  570.   "-fsigned-char",
  571.   "-funsigned-char",
  572.   "-fno-signed-char",
  573.   "-fno-unsigned-char",
  574.  
  575.   "-ftraditional",
  576.   "-traditional",
  577.   "-fnotraditional",
  578.   "-fno-traditional",
  579.  
  580.   "-fasm",
  581.   "-fno-asm",
  582.   "-fbuiltin",
  583.   "-fno-builtin",
  584.   "-fcond-mismatch",
  585.   "-fno-cond-mismatch",
  586.   "-fdollars-in-identifiers",
  587.   "-fno-dollars-in-identifiers",
  588.   "-fident",
  589.   "-fno-ident",
  590.   "-fshort-double",
  591.   "-fno-short-double",
  592.   "-fshort-enums",
  593.   "-fno-short-enums",
  594.  
  595.   "-Wall",
  596.   "-Wbad-function-cast",
  597.   "-Wno-bad-function-cast",
  598.   "-Wcast-qual",
  599.   "-Wno-cast-qual",
  600.   "-Wchar-subscripts",
  601.   "-Wno-char-subscripts",
  602.   "-Wcomment",
  603.   "-Wno-comment",
  604.   "-Wcomments",
  605.   "-Wno-comments",
  606.   "-Wconversion",
  607.   "-Wno-conversion",
  608.   "-Wformat",
  609.   "-Wno-format",
  610.   "-Wimport",
  611.   "-Wno-import",
  612.   "-Wimplicit",
  613.   "-Wno-implicit",
  614.   "-Wmissing-braces",
  615.   "-Wno-missing-braces",
  616.   "-Wmissing-declarations",
  617.   "-Wno-missing-declarations",
  618.   "-Wmissing-prototypes",
  619.   "-Wno-missing-prototypes",
  620.   "-Wnested-externs",
  621.   "-Wno-nested-externs",
  622.   "-Wparentheses",
  623.   "-Wno-parentheses",
  624.   "-Wpointer-arith",
  625.   "-Wno-pointer-arith",
  626.   "-Wredundant-decls",
  627.   "-Wno-redundant-decls",
  628.   "-Wstrict-prototypes",
  629.   "-Wno-strict-prototypes",
  630.   "-Wtraditional",
  631.   "-Wno-traditional",
  632.   "-Wtrigraphs",
  633.   "-Wno-trigraphs",
  634.   "-Wwrite-strings",
  635.   "-Wno-write-strings",
  636.  
  637.   /* These are for C++.  */
  638.   "-+e0",            /* gcc.c tacks the `-' on the front.  */
  639.   "-+e1",
  640.   "-+e2",
  641.   "-faccess-control",
  642.   "-fno-access-control",
  643.   "-fall-virtual",
  644.   "-fno-all-virtual",
  645.   "-falt-external-templates",
  646.   "-fno-alt-external-templates",
  647.   "-fansi-overloading",
  648.   "-fno-ansi-overloading",
  649.   "-fcadillac",
  650.   "-fno-cadillac",
  651.   "-fconserve-space",
  652.   "-fno-conserve-space",
  653.   "-fdefault-inline",
  654.   "-fno-default-inline",
  655.   "-fdossier",
  656.   "-fno-dossier",
  657.   "-felide-constructors",
  658.   "-fno-elide-constructors",
  659.   "-fenum-int-equiv",
  660.   "-fno-enum-int-equiv",
  661.   "-fexternal-templates",
  662.   "-fno-external-templates",
  663.   "-fgc",
  664.   "-fno-gc",
  665.   "-fhandle-exceptions",
  666.   "-fno-handle-exceptions",
  667.   "-fhandle-signatures",
  668.   "-fno-handle-signatures",
  669.   "-fhuge-objects",
  670.   "-fno-huge-objects",
  671.   "-fimplement-inlines",
  672.   "-fno-implement-inlines",
  673.   "-fimplicit-templates",
  674.   "-fno-implicit-templates",
  675.   "-flabels-ok",
  676.   "-fno-labels-ok",
  677.   "-fmemoize-lookups",
  678.   "-fno-memoize-lookups",
  679.   "-fnonnull-objects",
  680.   "-fno-nonnull-objects",
  681.   "-fsave-memoized",
  682.   "-fno-save-memoized",
  683.   "-fshort-temps",
  684.   "-fno-short-temps",
  685.   "-fstats",
  686.   "-fno-stats",
  687.   "-fstrict-prototype",
  688.   "-fno-strict-prototype",
  689.   "-fthis-is-variable",
  690.   "-fno-this-is-variable",
  691.   "-fvtable-thunks",
  692.   "-fno-vtable-thunks",
  693.   "-fxref",
  694.   "-fno-xref",
  695.  
  696.   "-Wreturn-type",
  697.   "-Wno-return-type",
  698.   "-Woverloaded-virtual",
  699.   "-Wno-overloaded-virtual",
  700.   "-Wenum-clash",
  701.   "-Wno-enum-clash",
  702.   "-Wtemplate-debugging",
  703.   "-Wno-template-debugging",
  704.   "-Wctor-dtor-privacy",
  705.   "-Wno-ctor-dtor-privacy",
  706.   "-Wnon-virtual-dtor",
  707.   "-Wno-non-virtual-dtor",
  708.   "-Wextern-inline",
  709.   "-Wno-extern-inline",
  710.   "-Wreorder",
  711.   "-Wno-reorder",
  712.   "-Wsynth",
  713.   "-Wno-synth",
  714.  
  715.   /* these are for obj c */
  716.   "-lang-objc",
  717.   "-gen-decls",
  718.   "-fgnu-runtime",
  719.   "-fno-gnu-runtime",
  720.   "-fnext-runtime",
  721.   "-fno-next-runtime",
  722.   "-Wselector",
  723.   "-Wno-selector",
  724.   "-Wprotocol",
  725.   "-Wno-protocol",
  726.  
  727.   /* This is for GNAT and is temporary.  */
  728.   "-gnat",
  729.   0
  730. };
  731.  
  732. /* Options controlling warnings */
  733.  
  734. /* Don't print warning messages.  -w.  */
  735.  
  736. int inhibit_warnings = 0;
  737.  
  738. /* Print various extra warnings.  -W.  */
  739.  
  740. int extra_warnings = 0;
  741.  
  742. /* Treat warnings as errors.  -Werror.  */
  743.  
  744. int warnings_are_errors = 0;
  745.  
  746. /* Nonzero to warn about unused local variables.  */
  747.  
  748. int warn_unused;
  749.  
  750. /* Nonzero to warn about variables used before they are initialized.  */
  751.  
  752. int warn_uninitialized;
  753.  
  754. /* Nonzero means warn about all declarations which shadow others.   */
  755.  
  756. int warn_shadow;
  757.  
  758. /* Warn if a switch on an enum fails to have a case for every enum value.  */
  759.  
  760. int warn_switch;
  761.  
  762. /* Nonzero means warn about function definitions that default the return type
  763.    or that use a null return and have a return-type other than void.  */
  764.  
  765. int warn_return_type;
  766.  
  767. /* Nonzero means warn about pointer casts that increase the required
  768.    alignment of the target type (and might therefore lead to a crash
  769.    due to a misaligned access).  */
  770.  
  771. int warn_cast_align;
  772.  
  773. /* Nonzero means warn about any identifiers that match in the first N
  774.    characters.  The value N is in `id_clash_len'.  */
  775.  
  776. int warn_id_clash;
  777. unsigned id_clash_len;
  778.  
  779. /* Nonzero means warn about any objects definitions whose size is larger
  780.    than N bytes.  Also want about function definitions whose returned
  781.    values are larger than N bytes. The value N is in `larger_than_size'.  */
  782.  
  783. int warn_larger_than;
  784. unsigned larger_than_size;
  785.  
  786. /* Nonzero means warn if inline function is too large.  */
  787.  
  788. int warn_inline;
  789.  
  790. /* Warn if a function returns an aggregate,
  791.    since there are often incompatible calling conventions for doing this.  */
  792.  
  793. int warn_aggregate_return;
  794.  
  795. /* Likewise for -W.  */
  796.  
  797. struct { char *string; int *variable; int on_value;} W_options[] =
  798. {
  799.   {"unused", &warn_unused, 1},
  800.   {"error", &warnings_are_errors, 1},
  801.   {"shadow", &warn_shadow, 1},
  802.   {"switch", &warn_switch, 1},
  803.   {"aggregate-return", &warn_aggregate_return, 1},
  804.   {"cast-align", &warn_cast_align, 1},
  805.   {"uninitialized", &warn_uninitialized, 1},
  806.   {"inline", &warn_inline, 1}
  807. };
  808.  
  809. /* Output files for assembler code (real compiler output)
  810.    and debugging dumps.  */
  811.  
  812. FILE *asm_out_file;
  813. FILE *aux_info_file;
  814. FILE *rtl_dump_file;
  815. FILE *jump_opt_dump_file;
  816. FILE *cse_dump_file;
  817. FILE *loop_dump_file;
  818. FILE *cse2_dump_file;
  819. FILE *flow_dump_file;
  820. FILE *combine_dump_file;
  821. FILE *sched_dump_file;
  822. FILE *local_reg_dump_file;
  823. FILE *global_reg_dump_file;
  824. FILE *sched2_dump_file;
  825. FILE *jump2_opt_dump_file;
  826. FILE *dbr_sched_dump_file;
  827. FILE *stack_reg_dump_file;
  828.  
  829. /* Time accumulators, to count the total time spent in various passes.  */
  830.  
  831. int parse_time;
  832. int varconst_time;
  833. int integration_time;
  834. int jump_time;
  835. int cse_time;
  836. int loop_time;
  837. int cse2_time;
  838. int flow_time;
  839. int combine_time;
  840. int sched_time;
  841. int local_alloc_time;
  842. int global_alloc_time;
  843. int sched2_time;
  844. int dbr_sched_time;
  845. int shorten_branch_time;
  846. int stack_reg_time;
  847. int final_time;
  848. int symout_time;
  849. int dump_time;
  850.  
  851. /* Return time used so far, in microseconds.  */
  852.  
  853. int
  854. get_run_time ()
  855. {
  856. #ifdef WINNT
  857.   return 0;
  858. #else
  859. #ifdef USG
  860.   struct tms tms;
  861. #else
  862. #ifndef VMS
  863.   struct rusage rusage;
  864. #else /* VMS */
  865.   struct
  866.     {
  867.       int proc_user_time;
  868.       int proc_system_time;
  869.       int child_user_time;
  870.       int child_system_time;
  871.     } vms_times;
  872. #endif
  873. #endif
  874.  
  875.   if (quiet_flag)
  876.     return 0;
  877.  
  878. #ifdef USG
  879.   times (&tms);
  880.   return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
  881. #else
  882. #ifndef VMS
  883.   getrusage (0, &rusage);
  884.   return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
  885.       + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
  886. #else /* VMS */
  887.   times (&vms_times);
  888.   return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
  889. #endif
  890. #endif
  891. #endif
  892. }
  893.  
  894. #define TIMEVAR(VAR, BODY)    \
  895. do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
  896.  
  897. void
  898. print_time (str, total)
  899.      char *str;
  900.      int total;
  901. {
  902.   fprintf (stderr,
  903.        "time in %s: %d.%06d\n",
  904.        str, total / 1000000, total % 1000000);
  905. }
  906.  
  907. /* Count an error or warning.  Return 1 if the message should be printed.  */
  908.  
  909. int
  910. count_error (warningp)
  911.      int warningp;
  912. {
  913.   if (warningp && inhibit_warnings)
  914.     return 0;
  915.  
  916.   if (warningp && !warnings_are_errors)
  917.     warningcount++;
  918.   else
  919.     {
  920.       static int warning_message = 0;
  921.  
  922.       if (warningp && !warning_message)
  923.     {
  924.       fprintf (stderr, "%s: warnings being treated as errors\n", progname);
  925.       warning_message = 1;
  926.     }
  927.       errorcount++;
  928.     }
  929.  
  930.   return 1;
  931. }
  932.  
  933. /* Print a fatal error message.  NAME is the text.
  934.    Also include a system error message based on `errno'.  */
  935.  
  936. void
  937. pfatal_with_name (name)
  938.      char *name;
  939. {
  940.   fprintf (stderr, "%s: ", progname);
  941.   perror (name);
  942.   exit (35);
  943. }
  944.  
  945. void
  946. fatal_io_error (name)
  947.      char *name;
  948. {
  949.   fprintf (stderr, "%s: %s: I/O error\n", progname, name);
  950.   exit (35);
  951. }
  952.  
  953. /* Called to give a better error message for a bad insn rather than
  954.    just calling abort().  */
  955.  
  956. void
  957. fatal_insn (message, insn)
  958.      char *message;
  959.      rtx insn;
  960. {
  961.   if (!output_bytecode)
  962.     {
  963.       error (message);
  964.       debug_rtx (insn);
  965.     }
  966.   if (asm_out_file)
  967.     fflush (asm_out_file);
  968.   if (aux_info_file)
  969.     fflush (aux_info_file);
  970.   if (rtl_dump_file)
  971.     fflush (rtl_dump_file);
  972.   if (jump_opt_dump_file)
  973.     fflush (jump_opt_dump_file);
  974.   if (cse_dump_file)
  975.     fflush (cse_dump_file);
  976.   if (loop_dump_file)
  977.     fflush (loop_dump_file);
  978.   if (cse2_dump_file)
  979.     fflush (cse2_dump_file);
  980.   if (flow_dump_file)
  981.     fflush (flow_dump_file);
  982.   if (combine_dump_file)
  983.     fflush (combine_dump_file);
  984.   if (sched_dump_file)
  985.     fflush (sched_dump_file);
  986.   if (local_reg_dump_file)
  987.     fflush (local_reg_dump_file);
  988.   if (global_reg_dump_file)
  989.     fflush (global_reg_dump_file);
  990.   if (sched2_dump_file)
  991.     fflush (sched2_dump_file);
  992.   if (jump2_opt_dump_file)
  993.     fflush (jump2_opt_dump_file);
  994.   if (dbr_sched_dump_file)
  995.     fflush (dbr_sched_dump_file);
  996.   if (stack_reg_dump_file)
  997.     fflush (stack_reg_dump_file);
  998.   abort ();
  999. }
  1000.  
  1001. /* Called to give a better error message when we don't have an insn to match
  1002.    what we are looking for or if the insn's constraints aren't satisfied,
  1003.    rather than just calling abort().  */
  1004.  
  1005. void
  1006. fatal_insn_not_found (insn)
  1007.      rtx insn;
  1008. {
  1009.   if (INSN_CODE (insn) < 0)
  1010.     fatal_insn ("internal error--unrecognizable insn:", insn);
  1011.   else
  1012.     fatal_insn ("internal error--insn does not satisfy its constraints:", insn);
  1013. }
  1014.  
  1015. /* This is the default decl_printable_name function.  */
  1016.  
  1017. static char *
  1018. decl_name (decl, kind)
  1019.      tree decl;
  1020.      char **kind;
  1021. {
  1022.   return IDENTIFIER_POINTER (DECL_NAME (decl));
  1023. }
  1024.  
  1025. /* This is the default interim_eh_hook function.  */
  1026.  
  1027. void
  1028. interim_eh (finalization)
  1029.      tree finalization;
  1030. {
  1031.   /* Don't do anything by default.  */
  1032. }
  1033.  
  1034. static int need_error_newline;
  1035.  
  1036. /* Function of last error message;
  1037.    more generally, function such that if next error message is in it
  1038.    then we don't have to mention the function name.  */
  1039. static tree last_error_function = NULL;
  1040.  
  1041. /* Used to detect when input_file_stack has changed since last described.  */
  1042. static int last_error_tick;
  1043.  
  1044. /* Called when the start of a function definition is parsed,
  1045.    this function prints on stderr the name of the function.  */
  1046.  
  1047. void
  1048. announce_function (decl)
  1049.      tree decl;
  1050. {
  1051.   if (! quiet_flag)
  1052.     {
  1053.       char *junk;
  1054.       if (rtl_dump_and_exit)
  1055.     fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
  1056.       else
  1057.     fprintf (stderr, " %s", (*decl_printable_name) (decl, &junk));
  1058.       fflush (stderr);
  1059.       need_error_newline = 1;
  1060.       last_error_function = current_function_decl;
  1061.     }
  1062. }
  1063.  
  1064. /* Prints out, if necessary, the name of the current function
  1065.    which caused an error.  Called from all error and warning functions.  */
  1066.  
  1067. void
  1068. report_error_function (file)
  1069.      char *file;
  1070. {
  1071.   struct file_stack *p;
  1072.  
  1073.   if (need_error_newline)
  1074.     {
  1075.       fprintf (stderr, "\n");
  1076.       need_error_newline = 0;
  1077.     }
  1078.  
  1079.   if (last_error_function != current_function_decl)
  1080.     {
  1081.       char *kind = "function";
  1082.       if (current_function_decl != 0
  1083.       && TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
  1084.     kind = "method";
  1085.  
  1086.       if (file)
  1087.     fprintf (stderr, "%s: ", file);
  1088.  
  1089.       if (current_function_decl == NULL)
  1090.     fprintf (stderr, "At top level:\n");
  1091.       else
  1092.     {
  1093.       char *name = (*decl_printable_name) (current_function_decl, &kind);
  1094.       fprintf (stderr, "In %s `%s':\n", kind, name);
  1095.     }
  1096.  
  1097.       last_error_function = current_function_decl;
  1098.     }
  1099.   if (input_file_stack && input_file_stack->next != 0
  1100.       && input_file_stack_tick != last_error_tick)
  1101.     {
  1102.       fprintf (stderr, "In file included");
  1103.       for (p = input_file_stack->next; p; p = p->next)
  1104.     {
  1105.       fprintf (stderr, " from %s:%d", p->name, p->line);
  1106.       if (p->next)
  1107.         fprintf (stderr, ",\n                ");
  1108.     }
  1109.       fprintf (stderr, ":\n");
  1110.       last_error_tick = input_file_stack_tick;
  1111.     }
  1112. }
  1113.  
  1114. /* Print a message.  */
  1115.  
  1116. static void
  1117. vmessage (prefix, s, ap)
  1118.      char *prefix;
  1119.      char *s;
  1120.      va_list ap;
  1121. {
  1122.   if (prefix)
  1123.     fprintf (stderr, "%s: ", prefix);
  1124.  
  1125. #ifdef HAVE_VPRINTF
  1126.   vfprintf (stderr, s, ap);
  1127. #else
  1128.   {
  1129.     HOST_WIDE_INT v1 = va_arg(ap, HOST_WIDE_INT);
  1130.     HOST_WIDE_INT v2 = va_arg(ap, HOST_WIDE_INT);
  1131.     HOST_WIDE_INT v3 = va_arg(ap, HOST_WIDE_INT);
  1132.     fprintf (stderr, s, v1, v2, v3);
  1133.   }
  1134. #endif
  1135. }
  1136.  
  1137. /* Print a message relevant to line LINE of file FILE.  */
  1138.  
  1139. static void
  1140. v_message_with_file_and_line (file, line, prefix, s, ap)
  1141.      char *file;
  1142.      int line;
  1143.      char *prefix;
  1144.      char *s;
  1145.      va_list ap;
  1146. {
  1147.   if (file)
  1148.     fprintf (stderr, "%s:%d: ", file, line);
  1149.   else
  1150.     fprintf (stderr, "%s: ", progname);
  1151.  
  1152.   vmessage (prefix, s, ap);
  1153.   fputc ('\n', stderr);
  1154. }
  1155.  
  1156. /* Print a message relevant to the given DECL.  */
  1157.  
  1158. static void
  1159. v_message_with_decl (decl, prefix, s, ap)
  1160.      tree decl;
  1161.      char *prefix;
  1162.      char *s;
  1163.      va_list ap;
  1164. {
  1165.   char *n, *p, *junk;
  1166.  
  1167.   fprintf (stderr, "%s:%d: ",
  1168.        DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
  1169.  
  1170.   if (prefix)
  1171.     fprintf (stderr, "%s: ", prefix);
  1172.  
  1173.   /* Do magic to get around lack of varargs support for insertion
  1174.      of arguments into existing list.  We know that the decl is first;
  1175.      we ass_u_me that it will be printed with "%s".  */
  1176.  
  1177.   for (p = s; *p; ++p)
  1178.     {
  1179.       if (*p == '%')
  1180.     {
  1181.       if (*(p + 1) == '%')
  1182.         ++p;
  1183.       else
  1184.         break;
  1185.     }
  1186.     }
  1187.  
  1188.   if (p > s)            /* Print the left-hand substring.  */
  1189.     {
  1190.       char fmt[sizeof "%.255s"];
  1191.       long width = p - s;
  1192.              
  1193.       if (width > 255L) width = 255L;    /* arbitrary */
  1194.       sprintf (fmt, "%%.%lds", width);
  1195.       fprintf (stderr, fmt, s);
  1196.     }
  1197.  
  1198.   if (*p == '%')        /* Print the name.  */
  1199.     {
  1200.       char *n = (DECL_NAME (decl)
  1201.          ? (*decl_printable_name) (decl, &junk)
  1202.          : "((anonymous))");
  1203.       fputs (n, stderr);
  1204.       while (*p)
  1205.     {
  1206.       ++p;
  1207.       if (isalpha (*(p - 1) & 0xFF))
  1208.         break;
  1209.     }
  1210.     }
  1211.  
  1212.   if (*p)            /* Print the rest of the message.  */
  1213.     vmessage ((char *)NULL, p, ap);
  1214.  
  1215.   fputc ('\n', stderr);
  1216. }
  1217.  
  1218. /* Figure file and line of the given INSN.  */
  1219.  
  1220. static void
  1221. file_and_line_for_asm (insn, pfile, pline)
  1222.      rtx insn;
  1223.      char **pfile;
  1224.      int *pline;
  1225. {
  1226.   rtx body = PATTERN (insn);
  1227.   rtx asmop;
  1228.  
  1229.   /* Find the (or one of the) ASM_OPERANDS in the insn.  */
  1230.   if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
  1231.     asmop = SET_SRC (body);
  1232.   else if (GET_CODE (body) == ASM_OPERANDS)
  1233.     asmop = body;
  1234.   else if (GET_CODE (body) == PARALLEL
  1235.        && GET_CODE (XVECEXP (body, 0, 0)) == SET)
  1236.     asmop = SET_SRC (XVECEXP (body, 0, 0));
  1237.   else if (GET_CODE (body) == PARALLEL
  1238.        && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
  1239.     asmop = XVECEXP (body, 0, 0);
  1240.   else
  1241.     asmop = NULL;
  1242.  
  1243.   if (asmop)
  1244.     {
  1245.       *pfile = ASM_OPERANDS_SOURCE_FILE (asmop);
  1246.       *pline = ASM_OPERANDS_SOURCE_LINE (asmop);
  1247.     }
  1248.   else
  1249.     {
  1250.       *pfile = input_filename;
  1251.       *pline = lineno;
  1252.     }
  1253. }
  1254.  
  1255. /* Report an error at line LINE of file FILE.  */
  1256.  
  1257. static void
  1258. v_error_with_file_and_line (file, line, s, ap)
  1259.      char *file;
  1260.      int line;
  1261.      char *s;
  1262.      va_list ap;
  1263. {
  1264.   count_error (0);
  1265.   report_error_function (file);
  1266.   v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
  1267. }
  1268.  
  1269. void
  1270. error_with_file_and_line VPROTO((char *file, int line, char *s, ...))
  1271. {
  1272. #ifndef __STDC__
  1273.   char *file;
  1274.   int line;
  1275.   char *s;
  1276. #endif
  1277.   va_list ap;
  1278.  
  1279.   VA_START (ap, s);
  1280.  
  1281. #ifndef __STDC__
  1282.   file = va_arg (ap, char *);
  1283.   line = va_arg (ap, int);
  1284.   s = va_arg (ap, char *);
  1285. #endif
  1286.  
  1287.   v_error_with_file_and_line (file, line, s, ap);
  1288.   va_end (ap);
  1289. }
  1290.  
  1291. /* Report an error at the declaration DECL.
  1292.    S is a format string which uses %s to substitute the declaration
  1293.    name; subsequent substitutions are a la printf.  */
  1294.  
  1295. static void
  1296. v_error_with_decl (decl, s, ap)
  1297.      tree decl;
  1298.      char *s;
  1299.      va_list ap;
  1300. {
  1301.   count_error (0);
  1302.   report_error_function (DECL_SOURCE_FILE (decl));
  1303.   v_message_with_decl (decl, (char *)NULL, s, ap);
  1304. }
  1305.  
  1306. void
  1307. error_with_decl VPROTO((tree decl, char *s, ...))
  1308. {
  1309. #ifndef __STDC__
  1310.   tree decl;
  1311.   char *s;
  1312. #endif
  1313.   va_list ap;
  1314.  
  1315.   VA_START (ap, s);
  1316.  
  1317. #ifndef __STDC__
  1318.   decl = va_arg (ap, tree);
  1319.   s = va_arg (ap, char *);
  1320. #endif
  1321.  
  1322.   v_error_with_decl (decl, s, ap);
  1323.   va_end (ap);
  1324. }
  1325.  
  1326. /* Report an error at the line number of the insn INSN.
  1327.    This is used only when INSN is an `asm' with operands,
  1328.    and each ASM_OPERANDS records its own source file and line.  */
  1329.  
  1330. static void
  1331. v_error_for_asm (insn, s, ap)
  1332.      rtx insn;
  1333.      char *s;
  1334.      va_list ap;
  1335. {
  1336.   char *file;
  1337.   int line;
  1338.  
  1339.   count_error (0);
  1340.   file_and_line_for_asm (insn, &file, &line);
  1341.   report_error_function (file);
  1342.   v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
  1343. }
  1344.  
  1345. void
  1346. error_for_asm VPROTO((rtx insn, char *s, ...))
  1347. {
  1348. #ifndef __STDC__
  1349.   rtx insn;
  1350.   char *s;
  1351. #endif
  1352.   va_list ap;
  1353.  
  1354.   VA_START (ap, s);
  1355.  
  1356. #ifndef __STDC__
  1357.   insn = va_arg (ap, rtx);
  1358.   s = va_arg (ap, char *);
  1359. #endif
  1360.  
  1361.   v_error_for_asm (insn, s, ap);
  1362.   va_end (ap);
  1363. }
  1364.  
  1365. /* Report an error at the current line number.  */
  1366.  
  1367. static void
  1368. verror (s, ap)
  1369.      char *s;
  1370.      va_list ap;
  1371. {
  1372.   v_error_with_file_and_line (input_filename, lineno, s, ap);
  1373. }
  1374.  
  1375. void
  1376. error VPROTO((char *s, ...))
  1377. {
  1378. #ifndef __STDC__
  1379.   char *s;
  1380. #endif
  1381.   va_list ap;
  1382.  
  1383.   VA_START (ap, s);
  1384.  
  1385. #ifndef __STDC__
  1386.   s = va_arg (ap, char *);
  1387. #endif
  1388.  
  1389.   verror (s, ap);
  1390.   va_end (ap);
  1391. }
  1392.  
  1393. /* Report a fatal error at the current line number.  */
  1394.  
  1395. static void
  1396. vfatal (s, ap)
  1397.      char *s;
  1398.      va_list ap;
  1399. {
  1400.   verror (s, ap);
  1401.   exit (34);
  1402. }
  1403.  
  1404. void
  1405. fatal VPROTO((char *s, ...))
  1406. {
  1407. #ifndef __STDC__
  1408.   char *s;
  1409. #endif
  1410.   va_list ap;
  1411.  
  1412.   VA_START (ap, s);
  1413.  
  1414. #ifndef __STDC__
  1415.   s = va_arg (ap, char *);
  1416. #endif
  1417.  
  1418.   vfatal (s, ap);
  1419.   va_end (ap);
  1420. }
  1421.  
  1422. /* Report a warning at line LINE of file FILE.  */
  1423.  
  1424. static void
  1425. v_warning_with_file_and_line (file, line, s, ap)
  1426.      char *file;
  1427.      int line;
  1428.      char *s;
  1429.      va_list ap;
  1430. {
  1431.   if (count_error (1))
  1432.     {
  1433.       report_error_function (file);
  1434.       v_message_with_file_and_line (file, line, "warning", s, ap);
  1435.     }
  1436. }
  1437.  
  1438. void
  1439. warning_with_file_and_line VPROTO((char *file, int line, char *s, ...))
  1440. {
  1441. #ifndef __STDC__
  1442.   char *file;
  1443.   int line;
  1444.   char *s;
  1445. #endif
  1446.   va_list ap;
  1447.  
  1448.   VA_START (ap, s);
  1449.  
  1450. #ifndef __STDC__
  1451.   file = va_arg (ap, char *);
  1452.   line = va_arg (ap, int);
  1453.   s = va_arg (ap, char *);
  1454. #endif
  1455.  
  1456.   v_warning_with_file_and_line (file, line, s, ap);
  1457.   va_end (ap);
  1458. }
  1459.  
  1460. /* Report a warning at the declaration DECL.
  1461.    S is a format string which uses %s to substitute the declaration
  1462.    name; subsequent substitutions are a la printf.  */
  1463.  
  1464. static void
  1465. v_warning_with_decl (decl, s, ap)
  1466.      tree decl;
  1467.      char *s;
  1468.      va_list ap;
  1469. {
  1470.   if (count_error (1))
  1471.     {
  1472.       report_error_function (DECL_SOURCE_FILE (decl));
  1473.       v_message_with_decl (decl, "warning", s, ap);
  1474.     }
  1475. }
  1476.  
  1477. void
  1478. warning_with_decl VPROTO((tree decl, char *s, ...))
  1479. {
  1480. #ifndef __STDC__
  1481.   tree decl;
  1482.   char *s;
  1483. #endif
  1484.   va_list ap;
  1485.  
  1486.   VA_START (ap, s);
  1487.  
  1488. #ifndef __STDC__
  1489.   decl = va_arg (ap, tree);
  1490.   s = va_arg (ap, char *);
  1491. #endif
  1492.  
  1493.   v_warning_with_decl (decl, s, ap);
  1494.   va_end (ap);
  1495. }
  1496.  
  1497. /* Report a warning at the line number of the insn INSN.
  1498.    This is used only when INSN is an `asm' with operands,
  1499.    and each ASM_OPERANDS records its own source file and line.  */
  1500.  
  1501. static void
  1502. v_warning_for_asm (insn, s, ap)
  1503.      rtx insn;
  1504.      char *s;
  1505.      va_list ap;
  1506. {
  1507.   if (count_error (1))
  1508.     {
  1509.       char *file;
  1510.       int line;
  1511.  
  1512.       file_and_line_for_asm (insn, &file, &line);
  1513.       report_error_function (file);
  1514.       v_message_with_file_and_line (file, line, "warning", s, ap);
  1515.     }
  1516. }
  1517.  
  1518. void
  1519. warning_for_asm VPROTO((rtx insn, char *s, ...))
  1520. {
  1521. #ifndef __STDC__
  1522.   rtx insn;
  1523.   char *s;
  1524. #endif
  1525.   va_list ap;
  1526.  
  1527.   VA_START (ap, s);
  1528.  
  1529. #ifndef __STDC__
  1530.   insn = va_arg (ap, rtx);
  1531.   s = va_arg (ap, char *);
  1532. #endif
  1533.  
  1534.   v_warning_for_asm (insn, s, ap);
  1535.   va_end (ap);
  1536. }
  1537.  
  1538. /* Report a warning at the current line number.  */
  1539.  
  1540. static void
  1541. vwarning (s, ap)
  1542.      char *s;
  1543.      va_list ap;
  1544. {
  1545.   v_warning_with_file_and_line (input_filename, lineno, s, ap);
  1546. }
  1547.  
  1548. void
  1549. warning VPROTO((char *s, ...))
  1550. {
  1551. #ifndef __STDC__
  1552.   char *s;
  1553. #endif
  1554.   va_list ap;
  1555.  
  1556.   VA_START (ap, s);
  1557.  
  1558. #ifndef __STDC__
  1559.   s = va_arg (ap, char *);
  1560. #endif
  1561.  
  1562.   vwarning (s, ap);
  1563.   va_end (ap);
  1564. }
  1565.  
  1566. /* These functions issue either warnings or errors depending on
  1567.    -pedantic-errors.  */
  1568.  
  1569. static void
  1570. vpedwarn (s, ap)
  1571.      char *s;
  1572.      va_list ap;
  1573. {
  1574.   if (flag_pedantic_errors)
  1575.     verror (s, ap);
  1576.   else
  1577.     vwarning (s, ap);
  1578. }
  1579.  
  1580. void
  1581. pedwarn VPROTO((char *s, ...))
  1582. {
  1583. #ifndef __STDC__
  1584.   char *s;
  1585. #endif
  1586.   va_list ap;
  1587.  
  1588.   VA_START (ap, s);
  1589.  
  1590. #ifndef __STDC__
  1591.   s = va_arg (ap, char *);
  1592. #endif
  1593.  
  1594.   vpedwarn (s, ap);
  1595.   va_end (ap);
  1596. }
  1597.  
  1598. static void
  1599. v_pedwarn_with_decl (decl, s, ap)
  1600.      tree decl;
  1601.      char *s;
  1602.      va_list ap;
  1603. {
  1604.   /* We don't want -pedantic-errors to cause the compilation to fail from
  1605.      "errors" in system header files.  Sometimes fixincludes can't fix what's
  1606.      broken (eg: unsigned char bitfields - fixing it may change the alignment
  1607.      which will cause programs to mysteriously fail because the C library
  1608.      or kernel uses the original layout).  There's no point in issuing a
  1609.      warning either, it's just unnecessary noise.  */
  1610.  
  1611.   if (! DECL_IN_SYSTEM_HEADER (decl))
  1612.     {
  1613.       if (flag_pedantic_errors)
  1614.     v_error_with_decl (decl, s, ap);
  1615.       else
  1616.     v_warning_with_decl (decl, s, ap);
  1617.     }
  1618. }
  1619.  
  1620. void
  1621. pedwarn_with_decl VPROTO((tree decl, char *s, ...))
  1622. {
  1623. #ifndef __STDC__
  1624.   tree decl;
  1625.   char *s;
  1626. #endif
  1627.   va_list ap;
  1628.  
  1629.   VA_START (ap, s);
  1630.  
  1631. #ifndef __STDC__
  1632.   decl = va_arg (ap, tree);
  1633.   s = va_arg (ap, char *);
  1634. #endif
  1635.  
  1636.   v_pedwarn_with_decl (decl, s, ap);
  1637.   va_end (ap);
  1638. }
  1639.  
  1640. static void
  1641. v_pedwarn_with_file_and_line (file, line, s, ap)
  1642.      char *file;
  1643.      int line;
  1644.      char *s;
  1645.      va_list ap;
  1646. {
  1647.   if (flag_pedantic_errors)
  1648.     v_error_with_file_and_line (file, line, s, ap);
  1649.   else
  1650.     v_warning_with_file_and_line (file, line, s, ap);
  1651. }
  1652.  
  1653. void
  1654. pedwarn_with_file_and_line VPROTO((char *file, int line, char *s, ...))
  1655. {
  1656. #ifndef __STDC__
  1657.   char *file;
  1658.   int line;
  1659.   char *s;
  1660. #endif
  1661.   va_list ap;
  1662.  
  1663.   VA_START (ap, s);
  1664.  
  1665. #ifndef __STDC__
  1666.   file = va_arg (ap, char *);
  1667.   line = va_arg (ap, int);
  1668.   s = va_arg (ap, char *);
  1669. #endif
  1670.  
  1671.   v_pedwarn_with_file_and_line (file, line, s, ap);
  1672.   va_end (ap);
  1673. }
  1674.  
  1675. /* Apologize for not implementing some feature.  */
  1676.  
  1677. static void
  1678. vsorry (s, ap)
  1679.      char *s;
  1680.      va_list ap;
  1681. {
  1682.   sorrycount++;
  1683.   if (input_filename)
  1684.     fprintf (stderr, "%s:%d: ", input_filename, lineno);
  1685.   else
  1686.     fprintf (stderr, "%s: ", progname);
  1687.   vmessage ("sorry, not implemented", s, ap);
  1688.   fputc ('\n', stderr);
  1689. }
  1690.  
  1691. void
  1692. sorry VPROTO((char *s, ...))
  1693. {
  1694. #ifndef __STDC__
  1695.   char *s;
  1696. #endif
  1697.   va_list ap;
  1698.  
  1699.   VA_START (ap, s);
  1700.  
  1701. #ifndef __STDC__
  1702.   s = va_arg (ap, char *);
  1703. #endif
  1704.  
  1705.   vsorry (s, ap);
  1706.   va_end (ap);
  1707. }
  1708.  
  1709. /* Apologize for not implementing some feature, then quit.  */
  1710.  
  1711. static void
  1712. v_really_sorry (s, ap)
  1713.      char *s;
  1714.      va_list ap;
  1715. {
  1716.   sorrycount++;
  1717.   if (input_filename)
  1718.     fprintf (stderr, "%s:%d: ", input_filename, lineno);
  1719.   else
  1720.     fprintf (stderr, "%s: ", progname);
  1721.   vmessage ("sorry, not implemented", s, ap);
  1722.   fatal (" (fatal)\n");
  1723. }
  1724.  
  1725. void
  1726. really_sorry VPROTO((char *s, ...))
  1727. {
  1728. #ifndef __STDC__
  1729.   char *s;
  1730. #endif
  1731.   va_list ap;
  1732.  
  1733.   VA_START (ap, s);
  1734.  
  1735. #ifndef __STDC__
  1736.   s = va_arg (ap, char *);
  1737. #endif
  1738.  
  1739.   v_really_sorry (s, ap);
  1740.   va_end (ap);
  1741. }
  1742.  
  1743. /* More 'friendly' abort that prints the line and file.
  1744.    config.h can #define abort fancy_abort if you like that sort of thing.
  1745.  
  1746.    I don't think this is actually a good idea.
  1747.    Other sorts of crashes will look a certain way.
  1748.    It is a good thing if crashes from calling abort look the same way.
  1749.      -- RMS  */
  1750.  
  1751. void
  1752. fancy_abort ()
  1753. {
  1754.   fatal ("internal gcc abort");
  1755. }
  1756.  
  1757. /* This calls abort and is used to avoid problems when abort if a macro.
  1758.    It is used when we need to pass the address of abort.  */
  1759.  
  1760. void
  1761. do_abort ()
  1762. {
  1763.   abort ();
  1764. }
  1765.  
  1766. /* When `malloc.c' is compiled with `rcheck' defined,
  1767.    it calls this function to report clobberage.  */
  1768.  
  1769. void
  1770. botch (s)
  1771. {
  1772.   abort ();
  1773. }
  1774.  
  1775. /* Same as `malloc' but report error if no memory available.  */
  1776.  
  1777. char *
  1778. xmalloc (size)
  1779.      unsigned size;
  1780. {
  1781.   register char *value = (char *) malloc (size);
  1782.   if (value == 0)
  1783.     fatal ("virtual memory exhausted");
  1784.   return value;
  1785. }
  1786.  
  1787. /* Same as `realloc' but report error if no memory available.  */
  1788.  
  1789. char *
  1790. xrealloc (ptr, size)
  1791.      char *ptr;
  1792.      int size;
  1793. {
  1794.   char *result = (char *) realloc (ptr, size);
  1795.   if (!result)
  1796.     fatal ("virtual memory exhausted");
  1797.   return result;
  1798. }
  1799.  
  1800. /* Return the logarithm of X, base 2, considering X unsigned,
  1801.    if X is a power of 2.  Otherwise, returns -1.
  1802.  
  1803.    This should be used via the `exact_log2' macro.  */
  1804.  
  1805. int
  1806. exact_log2_wide (x)
  1807.      register unsigned HOST_WIDE_INT x;
  1808. {
  1809.   register int log = 0;
  1810.   /* Test for 0 or a power of 2.  */
  1811.   if (x == 0 || x != (x & -x))
  1812.     return -1;
  1813.   while ((x >>= 1) != 0)
  1814.     log++;
  1815.   return log;
  1816. }
  1817.  
  1818. /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
  1819.    If X is 0, return -1.
  1820.  
  1821.    This should be used via the floor_log2 macro.  */
  1822.  
  1823. int
  1824. floor_log2_wide (x)
  1825.      register unsigned HOST_WIDE_INT x;
  1826. {
  1827.   register int log = -1;
  1828.   while (x != 0)
  1829.     log++,
  1830.     x >>= 1;
  1831.   return log;
  1832. }
  1833.  
  1834. int float_handled;
  1835. jmp_buf float_handler;
  1836.  
  1837. /* Specify where to longjmp to when a floating arithmetic error happens.
  1838.    If HANDLER is 0, it means don't handle the errors any more.  */
  1839.  
  1840. void
  1841. set_float_handler (handler)
  1842.      jmp_buf handler;
  1843. {
  1844.   float_handled = (handler != 0);
  1845.   if (handler)
  1846.     bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
  1847. }
  1848.  
  1849. /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
  1850.    error happens, pushing the previous specification into OLD_HANDLER.
  1851.    Return an indication of whether there was a previous handler in effect.  */
  1852.  
  1853. int
  1854. push_float_handler (handler, old_handler)
  1855.      jmp_buf handler, old_handler;
  1856. {
  1857.   int was_handled = float_handled;
  1858.  
  1859.   float_handled = 1;
  1860.   if (was_handled)
  1861.     bcopy ((char *) float_handler, (char *) old_handler,
  1862.        sizeof (float_handler));
  1863.  
  1864.   bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
  1865.   return was_handled;
  1866. }
  1867.  
  1868. /* Restore the previous specification of whether and where to longjmp to
  1869.    when a floating arithmetic error happens.  */
  1870.  
  1871. void
  1872. pop_float_handler (handled, handler)
  1873.      int handled;
  1874.      jmp_buf handler;
  1875. {
  1876.   float_handled = handled;
  1877.   if (handled)
  1878.     bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
  1879. }
  1880.  
  1881. /* Signals actually come here.  */
  1882.  
  1883. static void
  1884. float_signal (signo)
  1885.      /* If this is missing, some compilers complain.  */
  1886.      int signo;
  1887. {
  1888.   if (float_handled == 0)
  1889.     abort ();
  1890. #if defined (USG) || defined (hpux)
  1891.   signal (SIGFPE, float_signal);  /* re-enable the signal catcher */
  1892. #endif
  1893.   float_handled = 0;
  1894.   signal (SIGFPE, float_signal);
  1895.   longjmp (float_handler, 1);
  1896. }
  1897.  
  1898. /* Handler for SIGPIPE.  */
  1899.  
  1900. static void
  1901. pipe_closed (signo)
  1902.      /* If this is missing, some compilers complain.  */
  1903.      int signo;
  1904. {
  1905.   fatal ("output pipe has been closed");
  1906. }
  1907.  
  1908. /* Strip off a legitimate source ending from the input string NAME of
  1909.    length LEN. */
  1910.  
  1911. void
  1912. strip_off_ending (name, len)
  1913.      char *name;
  1914.      int len;
  1915. {
  1916.   if (len > 2 && ! strcmp (".c", name + len - 2))
  1917.     name[len - 2] = 0;
  1918.   else if (len > 2 && ! strcmp (".m", name + len - 2))
  1919.     name[len - 2] = 0;
  1920.   else if (len > 2 && ! strcmp (".i", name + len - 2))
  1921.     name[len - 2] = 0;
  1922.   else if (len > 3 && ! strcmp (".ii", name + len - 3))
  1923.     name[len - 3] = 0;
  1924.   else if (len > 3 && ! strcmp (".co", name + len - 3))
  1925.     name[len - 3] = 0;
  1926.   else if (len > 3 && ! strcmp (".cc", name + len - 3))
  1927.     name[len - 3] = 0;
  1928.   else if (len > 2 && ! strcmp (".C", name + len - 2))
  1929.     name[len - 2] = 0;
  1930.   else if (len > 4 && ! strcmp (".cxx", name + len - 4))
  1931.     name[len - 4] = 0;
  1932.   else if (len > 4 && ! strcmp (".cpp", name + len - 4))
  1933.     name[len - 4] = 0;
  1934.   else if (len > 2 && ! strcmp (".f", name + len - 2))
  1935.     name[len - 2] = 0;
  1936.   /* Ada will use extensions like .ada, .adb, and .ads, so just test
  1937.      for "ad".  */
  1938.   else if (len > 4 && ! strncmp (".ad", name + len - 4, 3))
  1939.     name[len - 4] = 0;
  1940.   else if (len > 4 && ! strcmp (".atr", name + len - 4))
  1941.     name[len - 4] = 0;
  1942. }
  1943.  
  1944. /* Output a quoted string.  */
  1945. void
  1946. output_quoted_string (asm_file, string)
  1947.      FILE *asm_file;
  1948.      char *string;
  1949. {
  1950.   char c;
  1951.  
  1952.   putc ('\"', asm_file);
  1953.   while ((c = *string++) != 0)
  1954.     {
  1955.       if (c == '\"' || c == '\\')
  1956.     putc ('\\', asm_file);
  1957.       putc (c, asm_file);
  1958.     }
  1959.   putc ('\"', asm_file);
  1960. }
  1961.  
  1962. /* Output a file name in the form wanted by System V.  */
  1963.  
  1964. void
  1965. output_file_directive (asm_file, input_name)
  1966.      FILE *asm_file;
  1967.      char *input_name;
  1968. {
  1969.   int len = strlen (input_name);
  1970.   char *na = input_name + len;
  1971.  
  1972.   /* NA gets INPUT_NAME sans directory names.  */
  1973.   while (na > input_name)
  1974.     {
  1975.       if (na[-1] == '/')
  1976.     break;
  1977.       na--;
  1978.     }
  1979.  
  1980. #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
  1981.   ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
  1982. #else
  1983. #ifdef ASM_OUTPUT_SOURCE_FILENAME
  1984.   ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
  1985. #else
  1986.   fprintf (asm_file, "\t.file\t");
  1987.   output_quoted_string (asm_file, na);
  1988.   fputc ('\n', asm_file);
  1989. #endif
  1990. #endif
  1991. }
  1992.  
  1993. /* Routine to build language identifier for object file. */
  1994. static void
  1995. output_lang_identify (asm_out_file)
  1996.      FILE *asm_out_file;
  1997. {
  1998.   int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
  1999.   char *s = (char *) alloca (len);
  2000.   sprintf (s, "__gnu_compiled_%s", lang_identify ());
  2001.   ASM_OUTPUT_LABEL (asm_out_file, s);
  2002. }
  2003.  
  2004. /* Routine to open a dump file.  */
  2005. static FILE *
  2006. open_dump_file (base_name, suffix)
  2007.      char *base_name;
  2008.      char *suffix;
  2009. {
  2010.   FILE *f;
  2011.   char *dumpname = (char *) alloca (strlen (base_name) + strlen (suffix) + 1);
  2012.  
  2013.   strcpy (dumpname, base_name);
  2014.   strcat (dumpname, suffix);
  2015.   f = fopen (dumpname, "w");
  2016.   if (f == 0)
  2017.     pfatal_with_name (dumpname);
  2018.   return f;
  2019. }
  2020.  
  2021. /* Compile an entire file of output from cpp, named NAME.
  2022.    Write a file of assembly output and various debugging dumps.  */
  2023.  
  2024. static void
  2025. compile_file (name)
  2026.      char *name;
  2027. {
  2028.   tree globals;
  2029.   int start_time;
  2030.  
  2031.   int name_specified = name != 0;
  2032.  
  2033.   if (dump_base_name == 0)
  2034.     dump_base_name = name ? name : "gccdump";
  2035.  
  2036.   parse_time = 0;
  2037.   varconst_time = 0;
  2038.   integration_time = 0;
  2039.   jump_time = 0;
  2040.   cse_time = 0;
  2041.   loop_time = 0;
  2042.   cse2_time = 0;
  2043.   flow_time = 0;
  2044.   combine_time = 0;
  2045.   sched_time = 0;
  2046.   local_alloc_time = 0;
  2047.   global_alloc_time = 0;
  2048.   sched2_time = 0;
  2049.   dbr_sched_time = 0;
  2050.   shorten_branch_time = 0;
  2051.   stack_reg_time = 0;
  2052.   final_time = 0;
  2053.   symout_time = 0;
  2054.   dump_time = 0;
  2055.  
  2056.   /* Open input file.  */
  2057.  
  2058.   if (name == 0 || !strcmp (name, "-"))
  2059.     {
  2060.       finput = stdin;
  2061.       name = "stdin";
  2062.     }
  2063.   else
  2064.     finput = fopen (name, "r");
  2065.   if (finput == 0)
  2066.     pfatal_with_name (name);
  2067.  
  2068. #ifdef IO_BUFFER_SIZE
  2069.   setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
  2070. #endif
  2071.  
  2072.   /* Initialize data in various passes.  */
  2073.  
  2074.   init_obstacks ();
  2075.   init_tree_codes ();
  2076.   init_lex ();
  2077.   /* Some of these really don't need to be called when generating bytecode,
  2078.      but the options would have to be parsed first to know that. -bson */
  2079.   init_rtl ();
  2080.   init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
  2081.           || debug_info_level == DINFO_LEVEL_VERBOSE);
  2082.   init_regs ();
  2083.   init_decl_processing ();
  2084.   init_optabs ();
  2085.   init_stmt ();
  2086.   init_expmed ();
  2087.   init_expr_once ();
  2088.   init_loop ();
  2089.   init_reload ();
  2090.  
  2091.   if (flag_caller_saves)
  2092.     init_caller_save ();
  2093.  
  2094.   /* If auxiliary info generation is desired, open the output file.
  2095.      This goes in the same directory as the source file--unlike
  2096.      all the other output files.  */
  2097.   if (flag_gen_aux_info)
  2098.     {
  2099.       aux_info_file = fopen (aux_info_file_name, "w");
  2100.       if (aux_info_file == 0)
  2101.     pfatal_with_name (aux_info_file_name);
  2102.     }
  2103.  
  2104.   /* If rtl dump desired, open the output file.  */
  2105.   if (rtl_dump)
  2106.     rtl_dump_file = open_dump_file (dump_base_name, ".rtl");
  2107.  
  2108.   /* If jump_opt dump desired, open the output file.  */
  2109.   if (jump_opt_dump)
  2110.     jump_opt_dump_file = open_dump_file (dump_base_name, ".jump");
  2111.  
  2112.   /* If cse dump desired, open the output file.  */
  2113.   if (cse_dump)
  2114.     cse_dump_file = open_dump_file (dump_base_name, ".cse");
  2115.  
  2116.   /* If loop dump desired, open the output file.  */
  2117.   if (loop_dump)
  2118.     loop_dump_file = open_dump_file (dump_base_name, ".loop");
  2119.  
  2120.   /* If cse2 dump desired, open the output file.  */
  2121.   if (cse2_dump)
  2122.     cse2_dump_file = open_dump_file (dump_base_name, ".cse2");
  2123.  
  2124.   /* If flow dump desired, open the output file.  */
  2125.   if (flow_dump)
  2126.     flow_dump_file = open_dump_file (dump_base_name, ".flow");
  2127.  
  2128.   /* If combine dump desired, open the output file.  */
  2129.   if (combine_dump)
  2130.     combine_dump_file = open_dump_file (dump_base_name, ".combine");
  2131.  
  2132.   /* If scheduling dump desired, open the output file.  */
  2133.   if (sched_dump)
  2134.     sched_dump_file = open_dump_file (dump_base_name, ".sched");
  2135.  
  2136.   /* If local_reg dump desired, open the output file.  */
  2137.   if (local_reg_dump)
  2138.     local_reg_dump_file = open_dump_file (dump_base_name, ".lreg");
  2139.  
  2140.   /* If global_reg dump desired, open the output file.  */
  2141.   if (global_reg_dump)
  2142.     global_reg_dump_file = open_dump_file (dump_base_name, ".greg");
  2143.  
  2144.   /* If 2nd scheduling dump desired, open the output file.  */
  2145.   if (sched2_dump)
  2146.     sched2_dump_file = open_dump_file (dump_base_name, ".sched2");
  2147.  
  2148.   /* If jump2_opt dump desired, open the output file.  */
  2149.   if (jump2_opt_dump)
  2150.     jump2_opt_dump_file = open_dump_file (dump_base_name, ".jump2");
  2151.  
  2152.   /* If dbr_sched dump desired, open the output file.  */
  2153.   if (dbr_sched_dump)
  2154.     dbr_sched_dump_file = open_dump_file (dump_base_name, ".dbr");
  2155.  
  2156. #ifdef STACK_REGS
  2157.  
  2158.   /* If stack_reg dump desired, open the output file.  */
  2159.   if (stack_reg_dump)
  2160.     stack_reg_dump_file = open_dump_file (dump_base_name, ".stack");
  2161.  
  2162. #endif
  2163.  
  2164.   /* Open assembler code output file.  */
  2165.  
  2166.   if (! name_specified && asm_file_name == 0)
  2167.     asm_out_file = stdout;
  2168.   else
  2169.     {
  2170.       int len = strlen (dump_base_name);
  2171.       register char *dumpname = (char *) xmalloc (len + 6);
  2172.       strcpy (dumpname, dump_base_name);
  2173.       strip_off_ending (dumpname, len);
  2174.       strcat (dumpname, ".s");
  2175.       if (asm_file_name == 0)
  2176.     {
  2177.       asm_file_name = (char *) xmalloc (strlen (dumpname) + 1);
  2178.       strcpy (asm_file_name, dumpname);
  2179.     }
  2180.       if (!strcmp (asm_file_name, "-"))
  2181.     asm_out_file = stdout;
  2182.       else
  2183.     asm_out_file = fopen (asm_file_name, "w");
  2184.       if (asm_out_file == 0)
  2185.     pfatal_with_name (asm_file_name);
  2186.     }
  2187.  
  2188. #ifdef IO_BUFFER_SIZE
  2189.   setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
  2190.        _IOFBF, IO_BUFFER_SIZE);
  2191. #endif
  2192.  
  2193.   input_filename = name;
  2194.  
  2195.   /* Perform language-specific initialization.
  2196.      This may set main_input_filename.  */
  2197.   lang_init ();
  2198.  
  2199.   /* If the input doesn't start with a #line, use the input name
  2200.      as the official input file name.  */
  2201.   if (main_input_filename == 0)
  2202.     main_input_filename = name;
  2203.  
  2204.   /* Put an entry on the input file stack for the main input file.  */
  2205.   input_file_stack
  2206.     = (struct file_stack *) xmalloc (sizeof (struct file_stack));
  2207.   input_file_stack->next = 0;
  2208.   input_file_stack->name = input_filename;
  2209.  
  2210.   if (!output_bytecode)
  2211.     {
  2212.       ASM_FILE_START (asm_out_file);
  2213.     }
  2214.  
  2215.   /* Output something to inform GDB that this compilation was by GCC.  Also
  2216.      serves to tell GDB file consists of bytecodes. */
  2217.   if (output_bytecode)
  2218.     fprintf (asm_out_file, "bc_gcc2_compiled.:\n");
  2219.   else
  2220.     {
  2221. #ifndef ASM_IDENTIFY_GCC
  2222.       fprintf (asm_out_file, "gcc2_compiled.:\n");
  2223. #else
  2224.       ASM_IDENTIFY_GCC (asm_out_file);
  2225. #endif
  2226.     }
  2227.  
  2228.   /* Output something to identify which front-end produced this file. */
  2229. #ifdef ASM_IDENTIFY_LANGUAGE
  2230.   ASM_IDENTIFY_LANGUAGE (asm_out_file);
  2231. #endif
  2232.  
  2233.   if (output_bytecode)
  2234.     {
  2235.       if (profile_flag || profile_block_flag)
  2236.     error ("profiling not supported in bytecode compilation");
  2237.     }
  2238.   else
  2239.     {
  2240.       /* ??? Note: There used to be a conditional here
  2241.      to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
  2242.      This was to guarantee separation between gcc_compiled. and
  2243.      the first function, for the sake of dbx on Suns.
  2244.      However, having the extra zero here confused the Emacs
  2245.      code for unexec, and might confuse other programs too.
  2246.      Therefore, I took out that change.
  2247.      In future versions we should find another way to solve
  2248.      that dbx problem.  -- rms, 23 May 93.  */
  2249.       
  2250.       /* Don't let the first function fall at the same address
  2251.      as gcc_compiled., if profiling.  */
  2252.       if (profile_flag || profile_block_flag)
  2253.     assemble_zeros (UNITS_PER_WORD);
  2254.     }
  2255.  
  2256.   /* If dbx symbol table desired, initialize writing it
  2257.      and output the predefined types.  */
  2258. #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
  2259.   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
  2260.     TIMEVAR (symout_time, dbxout_init (asm_out_file, main_input_filename,
  2261.                        getdecls ()));
  2262. #endif
  2263. #ifdef SDB_DEBUGGING_INFO
  2264.   if (write_symbols == SDB_DEBUG)
  2265.     TIMEVAR (symout_time, sdbout_init (asm_out_file, main_input_filename,
  2266.                        getdecls ()));
  2267. #endif
  2268. #ifdef DWARF_DEBUGGING_INFO
  2269.   if (write_symbols == DWARF_DEBUG)
  2270.     TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename));
  2271. #endif
  2272.  
  2273.   /* Initialize yet another pass.  */
  2274.  
  2275.   if (!output_bytecode)
  2276.     init_final (main_input_filename);
  2277.  
  2278.   start_time = get_run_time ();
  2279.  
  2280.   /* Call the parser, which parses the entire file
  2281.      (calling rest_of_compilation for each function).  */
  2282.  
  2283.   if (yyparse () != 0)
  2284.     {
  2285.       if (errorcount == 0)
  2286.     fprintf (stderr, "Errors detected in input file (your bison.simple is out of date)");
  2287.  
  2288.       /* In case there were missing closebraces,
  2289.      get us back to the global binding level.  */
  2290.       while (! global_bindings_p ())
  2291.     poplevel (0, 0, 0);
  2292.     }
  2293.  
  2294.   /* Compilation is now finished except for writing
  2295.      what's left of the symbol table output.  */
  2296.  
  2297.   parse_time += get_run_time () - start_time;
  2298.  
  2299.   parse_time -= integration_time;
  2300.   parse_time -= varconst_time;
  2301.  
  2302.   globals = getdecls ();
  2303.  
  2304.   /* Really define vars that have had only a tentative definition.
  2305.      Really output inline functions that must actually be callable
  2306.      and have not been output so far.  */
  2307.  
  2308.   {
  2309.     int len = list_length (globals);
  2310.     tree *vec = (tree *) alloca (sizeof (tree) * len);
  2311.     int i;
  2312.     tree decl;
  2313.     int reconsider = 1;
  2314.  
  2315.     /* Process the decls in reverse order--earliest first.
  2316.        Put them into VEC from back to front, then take out from front.  */
  2317.  
  2318.     for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
  2319.       vec[len - i - 1] = decl;
  2320.  
  2321.     for (i = 0; i < len; i++)
  2322.       {
  2323.     decl = vec[i];
  2324.  
  2325.     /* We're not deferring this any longer.  */
  2326.     DECL_DEFER_OUTPUT (decl) = 0;
  2327.  
  2328.     if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
  2329.         && incomplete_decl_finalize_hook != 0)
  2330.       (*incomplete_decl_finalize_hook) (decl);
  2331.       }
  2332.  
  2333.     /* Now emit any global variables or functions that we have been putting
  2334.        off.  We need to loop in case one of the things emitted here
  2335.        references another one which comes earlier in the list.  */
  2336.     while (reconsider)
  2337.       {
  2338.     reconsider = 0;
  2339.     for (i = 0; i < len; i++)
  2340.       {
  2341.         decl = vec[i];
  2342.  
  2343.         if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
  2344.           continue;
  2345.  
  2346.         /* Don't write out static consts, unless we still need them.
  2347.  
  2348.            We also keep static consts if not optimizing (for debugging).
  2349.            ??? They might be better written into the debug information.
  2350.            This is possible when using DWARF.
  2351.  
  2352.            A language processor that wants static constants to be always
  2353.            written out (even if it is not used) is responsible for
  2354.            calling rest_of_decl_compilation itself.  E.g. the C front-end
  2355.            calls rest_of_decl_compilation from finish_decl.
  2356.            One motivation for this is that is conventional in some
  2357.            environments to write things like:
  2358.                static const char rcsid[] = "... version string ...";
  2359.            intending to force the string to be in the executable.
  2360.  
  2361.            A language processor that would prefer to have unneeded
  2362.            static constants "optimized away" would just defer writing
  2363.            them out until here.  E.g. C++ does this, because static
  2364.            constants are often defined in header files.
  2365.  
  2366.            ??? A tempting alternative (for both C and C++) would be
  2367.            to force a constant to be written if and only if it is
  2368.            defined in a main file, as opposed to an include file. */
  2369.  
  2370.         if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
  2371.         && (! TREE_READONLY (decl)
  2372.             || TREE_PUBLIC (decl)
  2373.             || !optimize
  2374.             || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
  2375.           {
  2376.         reconsider = 1;
  2377.         rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
  2378.           }
  2379.  
  2380.         if (TREE_CODE (decl) == FUNCTION_DECL
  2381.         && DECL_INITIAL (decl) != 0
  2382.         && DECL_SAVED_INSNS (decl) != 0
  2383.         && (flag_keep_inline_functions
  2384.             || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
  2385.           {
  2386.         reconsider = 1;
  2387.         temporary_allocation ();
  2388.         output_inline_function (decl);
  2389.         permanent_allocation (1);
  2390.           }
  2391.       }
  2392.       }
  2393.  
  2394.     for (i = 0; i < len; i++)
  2395.       {
  2396.     decl = vec[i];
  2397.  
  2398.     if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
  2399.         && ! TREE_ASM_WRITTEN (decl))
  2400.       /* Cancel the RTL for this decl so that, if debugging info
  2401.          output for global variables is still to come,
  2402.          this one will be omitted.  */
  2403.       DECL_RTL (decl) = NULL;
  2404.  
  2405.     /* Warn about any function
  2406.        declared static but not defined.
  2407.        We don't warn about variables,
  2408.        because many programs have static variables
  2409.        that exist only to get some text into the object file.  */
  2410.     if (TREE_CODE (decl) == FUNCTION_DECL
  2411.         && (warn_unused
  2412.         || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
  2413.         && DECL_INITIAL (decl) == 0
  2414.         && DECL_EXTERNAL (decl)
  2415.         && ! TREE_PUBLIC (decl))
  2416.       {
  2417.         pedwarn_with_decl (decl, 
  2418.                    "`%s' declared `static' but never defined");
  2419.         /* This symbol is effectively an "extern" declaration now.  */
  2420.         TREE_PUBLIC (decl) = 1;
  2421.         assemble_external (decl);
  2422.       }
  2423.  
  2424.     /* Warn about static fns or vars defined but not used,
  2425.        but not about inline functions or static consts
  2426.        since defining those in header files is normal practice.  */
  2427.     if (warn_unused
  2428.         && ((TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
  2429.         || (TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
  2430.         && ! DECL_IN_SYSTEM_HEADER (decl)
  2431.         && ! DECL_EXTERNAL (decl)
  2432.         && ! TREE_PUBLIC (decl)
  2433.         && ! TREE_USED (decl)
  2434.         && ! DECL_REGISTER (decl)
  2435.         /* The TREE_USED bit for file-scope decls
  2436.            is kept in the identifier, to handle multiple
  2437.            external decls in different scopes.  */
  2438.         && ! TREE_USED (DECL_NAME (decl)))
  2439.       warning_with_decl (decl, "`%s' defined but not used");
  2440.  
  2441. #ifdef SDB_DEBUGGING_INFO
  2442.     /* The COFF linker can move initialized global vars to the end.
  2443.        And that can screw up the symbol ordering.
  2444.        By putting the symbols in that order to begin with,
  2445.        we avoid a problem.  mcsun!unido!fauern!tumuc!pes@uunet.uu.net.  */
  2446.     if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
  2447.         && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
  2448.         && ! DECL_EXTERNAL (decl)
  2449.         && DECL_RTL (decl) != 0)
  2450.       TIMEVAR (symout_time, sdbout_symbol (decl, 0));
  2451.  
  2452.     /* Output COFF information for non-global
  2453.        file-scope initialized variables. */
  2454.     if (write_symbols == SDB_DEBUG
  2455.         && TREE_CODE (decl) == VAR_DECL
  2456.         && DECL_INITIAL (decl)
  2457.         && ! DECL_EXTERNAL (decl)
  2458.         && DECL_RTL (decl) != 0
  2459.         && GET_CODE (DECL_RTL (decl)) == MEM)
  2460.       TIMEVAR (symout_time, sdbout_toplevel_data (decl));
  2461. #endif /* SDB_DEBUGGING_INFO */
  2462. #ifdef DWARF_DEBUGGING_INFO
  2463.     /* Output DWARF information for file-scope tentative data object
  2464.        declarations, file-scope (extern) function declarations (which
  2465.        had no corresponding body) and file-scope tagged type declarations
  2466.        and definitions which have not yet been forced out.  */
  2467.  
  2468.     if (write_symbols == DWARF_DEBUG
  2469.         && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
  2470.       TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1));
  2471. #endif
  2472.       }
  2473.   }
  2474.  
  2475.   /* Do dbx symbols */
  2476. #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
  2477.   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
  2478.     TIMEVAR (symout_time,
  2479.          {
  2480.            dbxout_finish (asm_out_file, main_input_filename);
  2481.          });
  2482. #endif
  2483.  
  2484. #ifdef DWARF_DEBUGGING_INFO
  2485.   if (write_symbols == DWARF_DEBUG)
  2486.     TIMEVAR (symout_time,
  2487.          {
  2488.            dwarfout_finish ();
  2489.          });
  2490. #endif
  2491.  
  2492.   /* Output some stuff at end of file if nec.  */
  2493.  
  2494.   if (!output_bytecode)
  2495.     {
  2496.       end_final (main_input_filename);
  2497.  
  2498. #ifdef ASM_FILE_END
  2499.       ASM_FILE_END (asm_out_file);
  2500. #endif
  2501.     }
  2502.  
  2503.   /* Language-specific end of compilation actions.  */
  2504.  
  2505.   lang_finish ();
  2506.  
  2507.   if (output_bytecode)
  2508.     bc_write_file (asm_out_file);
  2509.  
  2510.   /* Close the dump files.  */
  2511.  
  2512.   if (flag_gen_aux_info)
  2513.     {
  2514.       fclose (aux_info_file);
  2515.       if (errorcount)
  2516.     unlink (aux_info_file_name);
  2517.     }
  2518.  
  2519.   if (rtl_dump)
  2520.     fclose (rtl_dump_file);
  2521.  
  2522.   if (jump_opt_dump)
  2523.     fclose (jump_opt_dump_file);
  2524.  
  2525.   if (cse_dump)
  2526.     fclose (cse_dump_file);
  2527.  
  2528.   if (loop_dump)
  2529.     fclose (loop_dump_file);
  2530.  
  2531.   if (cse2_dump)
  2532.     fclose (cse2_dump_file);
  2533.  
  2534.   if (flow_dump)
  2535.     fclose (flow_dump_file);
  2536.  
  2537.   if (combine_dump)
  2538.     {
  2539.       dump_combine_total_stats (combine_dump_file);
  2540.       fclose (combine_dump_file);
  2541.     }
  2542.  
  2543.   if (sched_dump)
  2544.     fclose (sched_dump_file);
  2545.  
  2546.   if (local_reg_dump)
  2547.     fclose (local_reg_dump_file);
  2548.  
  2549.   if (global_reg_dump)
  2550.     fclose (global_reg_dump_file);
  2551.  
  2552.   if (sched2_dump)
  2553.     fclose (sched2_dump_file);
  2554.  
  2555.   if (jump2_opt_dump)
  2556.     fclose (jump2_opt_dump_file);
  2557.  
  2558.   if (dbr_sched_dump)
  2559.     fclose (dbr_sched_dump_file);
  2560.  
  2561. #ifdef STACK_REGS
  2562.   if (stack_reg_dump)
  2563.     fclose (stack_reg_dump_file);
  2564. #endif
  2565.  
  2566.   /* Close non-debugging input and output files.  Take special care to note
  2567.      whether fclose returns an error, since the pages might still be on the
  2568.      buffer chain while the file is open.  */
  2569.  
  2570.   fclose (finput);
  2571.   if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0)
  2572.     fatal_io_error (asm_file_name);
  2573.  
  2574.   /* Print the times.  */
  2575.  
  2576.   if (! quiet_flag)
  2577.     {
  2578.       fprintf (stderr,"\n");
  2579.       print_time ("parse", parse_time);
  2580.  
  2581.       if (!output_bytecode)
  2582.     {
  2583.       print_time ("integration", integration_time);
  2584.       print_time ("jump", jump_time);
  2585.       print_time ("cse", cse_time);
  2586.       print_time ("loop", loop_time);
  2587.       print_time ("cse2", cse2_time);
  2588.       print_time ("flow", flow_time);
  2589.       print_time ("combine", combine_time);
  2590.       print_time ("sched", sched_time);
  2591.       print_time ("local-alloc", local_alloc_time);
  2592.       print_time ("global-alloc", global_alloc_time);
  2593.       print_time ("sched2", sched2_time);
  2594.       print_time ("dbranch", dbr_sched_time);
  2595.       print_time ("shorten-branch", shorten_branch_time);
  2596.       print_time ("stack-reg", stack_reg_time);
  2597.       print_time ("final", final_time);
  2598.       print_time ("varconst", varconst_time);
  2599.       print_time ("symout", symout_time);
  2600.       print_time ("dump", dump_time);
  2601.     }
  2602.     }
  2603. }
  2604.  
  2605. /* This is called from various places for FUNCTION_DECL, VAR_DECL,
  2606.    and TYPE_DECL nodes.
  2607.  
  2608.    This does nothing for local (non-static) variables.
  2609.    Otherwise, it sets up the RTL and outputs any assembler code
  2610.    (label definition, storage allocation and initialization).
  2611.  
  2612.    DECL is the declaration.  If ASMSPEC is nonzero, it specifies
  2613.    the assembler symbol name to be used.  TOP_LEVEL is nonzero
  2614.    if this declaration is not within a function.  */
  2615.  
  2616. void
  2617. rest_of_decl_compilation (decl, asmspec, top_level, at_end)
  2618.      tree decl;
  2619.      char *asmspec;
  2620.      int top_level;
  2621.      int at_end;
  2622. {
  2623.   /* Declarations of variables, and of functions defined elsewhere.  */
  2624.  
  2625. /* The most obvious approach, to put an #ifndef around where
  2626.    this macro is used, doesn't work since it's inside a macro call.  */
  2627. #ifndef ASM_FINISH_DECLARE_OBJECT
  2628. #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
  2629. #endif
  2630.  
  2631.   /* Forward declarations for nested functions are not "external",
  2632.      but we need to treat them as if they were.  */
  2633.   if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
  2634.       || TREE_CODE (decl) == FUNCTION_DECL)
  2635.     TIMEVAR (varconst_time,
  2636.          {
  2637.            make_decl_rtl (decl, asmspec, top_level);
  2638.            /* Initialized extern variable exists to be replaced
  2639.           with its value, or represents something that will be
  2640.           output in another file.  */
  2641.            if (! (TREE_CODE (decl) == VAR_DECL
  2642.               && DECL_EXTERNAL (decl) && TREE_READONLY (decl)
  2643.               && DECL_INITIAL (decl) != 0
  2644.               && DECL_INITIAL (decl) != error_mark_node))
  2645.          /* Don't output anything
  2646.             when a tentative file-scope definition is seen.
  2647.             But at end of compilation, do output code for them.  */
  2648.          if (! (! at_end && top_level
  2649.             && (DECL_INITIAL (decl) == 0
  2650.                 || DECL_INITIAL (decl) == error_mark_node)))
  2651.            assemble_variable (decl, top_level, at_end, 0);
  2652.            if (decl == last_assemble_variable_decl)
  2653.          {
  2654.            ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
  2655.                           top_level, at_end);
  2656.          }
  2657.          });
  2658.   else if (DECL_REGISTER (decl) && asmspec != 0)
  2659.     {
  2660.       if (decode_reg_name (asmspec) >= 0)
  2661.     {
  2662.       DECL_RTL (decl) = 0;
  2663.       make_decl_rtl (decl, asmspec, top_level);
  2664.     }
  2665.       else
  2666.     error ("invalid register name `%s' for register variable", asmspec);
  2667.     }
  2668. #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
  2669.   else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
  2670.        && TREE_CODE (decl) == TYPE_DECL)
  2671.     TIMEVAR (symout_time, dbxout_symbol (decl, 0));
  2672. #endif
  2673. #ifdef SDB_DEBUGGING_INFO
  2674.   else if (write_symbols == SDB_DEBUG && top_level
  2675.        && TREE_CODE (decl) == TYPE_DECL)
  2676.     TIMEVAR (symout_time, sdbout_symbol (decl, 0));
  2677. #endif
  2678. }
  2679.  
  2680. /* Called after finishing a record, union or enumeral type.  */
  2681.  
  2682. void
  2683. rest_of_type_compilation (type, toplev)
  2684.      tree type;
  2685.      int toplev;
  2686. {
  2687. #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
  2688.   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
  2689.     TIMEVAR (symout_time, dbxout_symbol (TYPE_STUB_DECL (type), !toplev));
  2690. #endif
  2691. #ifdef SDB_DEBUGGING_INFO
  2692.   if (write_symbols == SDB_DEBUG)
  2693.     TIMEVAR (symout_time, sdbout_symbol (TYPE_STUB_DECL (type), !toplev));
  2694. #endif
  2695. }
  2696.  
  2697. /* This is called from finish_function (within yyparse)
  2698.    after each top-level definition is parsed.
  2699.    It is supposed to compile that function or variable
  2700.    and output the assembler code for it.
  2701.    After we return, the tree storage is freed.  */
  2702.  
  2703. void
  2704. rest_of_compilation (decl)
  2705.      tree decl;
  2706. {
  2707.   register rtx insns;
  2708.   int start_time = get_run_time ();
  2709.   int tem;
  2710.   /* Nonzero if we have saved the original DECL_INITIAL of the function,
  2711.      to be restored after we finish compiling the function
  2712.      (for use when compiling inline calls to this function).  */
  2713.   tree saved_block_tree = 0;
  2714.   /* Likewise, for DECL_ARGUMENTS.  */
  2715.   tree saved_arguments = 0;
  2716.   int failure = 0;
  2717.  
  2718.   if (output_bytecode)
  2719.     return;
  2720.  
  2721.   /* If we are reconsidering an inline function
  2722.      at the end of compilation, skip the stuff for making it inline.  */
  2723.  
  2724.   if (DECL_SAVED_INSNS (decl) == 0)
  2725.     {
  2726.       int specd = DECL_INLINE (decl);
  2727.       char *lose;
  2728.  
  2729.       /* If requested, consider whether to make this function inline.  */
  2730.       if (specd || flag_inline_functions)
  2731.     TIMEVAR (integration_time,
  2732.          {
  2733.            lose = function_cannot_inline_p (decl);
  2734.            /* If not optimzing, then make sure the DECL_INLINE
  2735.               bit is off.  */
  2736.            if (lose || ! optimize)
  2737.              {
  2738.                if (warn_inline && specd)
  2739.              warning_with_decl (decl, lose);
  2740.                DECL_INLINE (decl) = 0;
  2741.                DECL_ABSTRACT_ORIGIN (decl) = 0;
  2742.                /* Don't really compile an extern inline function.
  2743.               If we can't make it inline, pretend
  2744.               it was only declared.  */
  2745.                if (DECL_EXTERNAL (decl))
  2746.              {
  2747.                DECL_INITIAL (decl) = 0;
  2748.                goto exit_rest_of_compilation;
  2749.              }
  2750.              }
  2751.            else
  2752.              DECL_INLINE (decl) = 1;
  2753.          });
  2754.  
  2755.       insns = get_insns ();
  2756.  
  2757.       /* Dump the rtl code if we are dumping rtl.  */
  2758.  
  2759.       if (rtl_dump)
  2760.     TIMEVAR (dump_time,
  2761.          {
  2762.            fprintf (rtl_dump_file, "\n;; Function %s\n\n",
  2763.                 IDENTIFIER_POINTER (DECL_NAME (decl)));
  2764.            if (DECL_SAVED_INSNS (decl))
  2765.              fprintf (rtl_dump_file, ";; (integrable)\n\n");
  2766.            print_rtl (rtl_dump_file, insns);
  2767.            fflush (rtl_dump_file);
  2768.          });
  2769.  
  2770.       /* If function is inline, and we don't yet know whether to
  2771.      compile it by itself, defer decision till end of compilation.
  2772.      finish_compilation will call rest_of_compilation again
  2773.      for those functions that need to be output.  Also defer those
  2774.      functions that were marked inline but weren't inlined; they
  2775.      may never be used.  */
  2776.  
  2777.       if ((specd || DECL_INLINE (decl))
  2778.       && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
  2779.            && ! flag_keep_inline_functions)
  2780.           || DECL_DEFER_OUTPUT (decl)
  2781.           || DECL_EXTERNAL (decl)))
  2782.     {
  2783. #ifdef DWARF_DEBUGGING_INFO
  2784.       /* Generate the DWARF info for the "abstract" instance
  2785.          of a function which we may later generate inlined and/or
  2786.          out-of-line instances of.  */
  2787.       if (write_symbols == DWARF_DEBUG)
  2788.         {
  2789.           set_decl_abstract_flags (decl, 1);
  2790.           TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
  2791.           set_decl_abstract_flags (decl, 0);
  2792.         }
  2793. #endif
  2794.       TIMEVAR (integration_time, save_for_inline_nocopy (decl));
  2795.       goto exit_rest_of_compilation;
  2796.     }
  2797.  
  2798.       /* If we have to compile the function now, save its rtl and subdecls
  2799.      so that its compilation will not affect what others get.  */
  2800.       if (DECL_INLINE (decl))
  2801.     {
  2802. #ifdef DWARF_DEBUGGING_INFO
  2803.       /* Generate the DWARF info for the "abstract" instance of
  2804.          a function which we will generate an out-of-line instance
  2805.          of almost immediately (and which we may also later generate
  2806.          various inlined instances of).  */
  2807.       if (write_symbols == DWARF_DEBUG)
  2808.         {
  2809.           set_decl_abstract_flags (decl, 1);
  2810.           TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
  2811.           set_decl_abstract_flags (decl, 0);
  2812.         }
  2813. #endif
  2814.       saved_block_tree = DECL_INITIAL (decl);
  2815.       saved_arguments = DECL_ARGUMENTS (decl);
  2816.       TIMEVAR (integration_time, save_for_inline_copying (decl));
  2817.     }
  2818.     }
  2819.  
  2820.   if (DECL_DEFER_OUTPUT (decl))
  2821.     goto exit_rest_of_compilation;
  2822.  
  2823.   TREE_ASM_WRITTEN (decl) = 1;
  2824.  
  2825.   /* Now that integrate will no longer see our rtl, we need not distinguish
  2826.      between the return value of this function and the return value of called
  2827.      functions.  */
  2828.   rtx_equal_function_value_matters = 0;
  2829.  
  2830.   /* Don't return yet if -Wreturn-type; we need to do jump_optimize.  */
  2831.   if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
  2832.     {
  2833.       goto exit_rest_of_compilation;
  2834.     }
  2835.  
  2836.   /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
  2837.      Note that that may have been done above, in save_for_inline_copying.
  2838.      The call to resume_temporary_allocation near the end of this function
  2839.      goes back to the usual state of affairs.  */
  2840.  
  2841.   rtl_in_current_obstack ();
  2842.  
  2843. #ifdef FINALIZE_PIC
  2844.   /* If we are doing position-independent code generation, now
  2845.      is the time to output special prologues and epilogues.
  2846.      We do not want to do this earlier, because it just clutters
  2847.      up inline functions with meaningless insns.  */
  2848.   if (flag_pic)
  2849.     FINALIZE_PIC;
  2850. #endif
  2851.  
  2852.   insns = get_insns ();
  2853.  
  2854.   /* Copy any shared structure that should not be shared.  */
  2855.  
  2856.   unshare_all_rtl (insns);
  2857.  
  2858.   /* Instantiate all virtual registers.  */
  2859.  
  2860.   instantiate_virtual_regs (current_function_decl, get_insns ());
  2861.  
  2862.   /* See if we have allocated stack slots that are not directly addressable.
  2863.      If so, scan all the insns and create explicit address computation
  2864.      for all references to such slots.  */
  2865. /*   fixup_stack_slots (); */
  2866.  
  2867.   /* Do jump optimization the first time, if -opt.
  2868.      Also do it if -W, but in that case it doesn't change the rtl code,
  2869.      it only computes whether control can drop off the end of the function.  */
  2870.  
  2871.   if (optimize > 0 || extra_warnings || warn_return_type
  2872.       /* If function is `noreturn', we should warn if it tries to return.  */
  2873.       || TREE_THIS_VOLATILE (decl))
  2874.     {
  2875.       TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
  2876.       TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 1));
  2877.     }
  2878.  
  2879.   /* Now is when we stop if -fsyntax-only and -Wreturn-type.  */
  2880.   if (rtl_dump_and_exit || flag_syntax_only)
  2881.     goto exit_rest_of_compilation;
  2882.  
  2883.   /* Dump rtl code after jump, if we are doing that.  */
  2884.  
  2885.   if (jump_opt_dump)
  2886.     TIMEVAR (dump_time,
  2887.          {
  2888.            fprintf (jump_opt_dump_file, "\n;; Function %s\n\n",
  2889.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2890.            print_rtl (jump_opt_dump_file, insns);
  2891.            fflush (jump_opt_dump_file);
  2892.          });
  2893.  
  2894.   /* Perform common subexpression elimination.
  2895.      Nonzero value from `cse_main' means that jumps were simplified
  2896.      and some code may now be unreachable, so do
  2897.      jump optimization again.  */
  2898.  
  2899.   if (cse_dump)
  2900.     TIMEVAR (dump_time,
  2901.          {
  2902.            fprintf (cse_dump_file, "\n;; Function %s\n\n",
  2903.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2904.          });
  2905.  
  2906.   if (optimize > 0)
  2907.     {
  2908.       TIMEVAR (cse_time, reg_scan (insns, max_reg_num (), 1));
  2909.  
  2910.       if (flag_thread_jumps)
  2911.     /* Hacks by tiemann & kenner.  */
  2912.     TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 1));
  2913.  
  2914.       TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num (),
  2915.                      0, cse_dump_file));
  2916.       TIMEVAR (cse_time, delete_dead_from_cse (insns, max_reg_num ()));
  2917.  
  2918.       if (tem)
  2919.     TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
  2920.     }
  2921.  
  2922.   /* Dump rtl code after cse, if we are doing that.  */
  2923.  
  2924.   if (cse_dump)
  2925.     TIMEVAR (dump_time,
  2926.          {
  2927.            print_rtl (cse_dump_file, insns);
  2928.            fflush (cse_dump_file);
  2929.          });
  2930.  
  2931.   if (loop_dump)
  2932.     TIMEVAR (dump_time,
  2933.          {
  2934.            fprintf (loop_dump_file, "\n;; Function %s\n\n",
  2935.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2936.          });
  2937.  
  2938.   /* Move constant computations out of loops.  */
  2939.  
  2940.   if (optimize > 0)
  2941.     {
  2942.       TIMEVAR (loop_time,
  2943.            {
  2944.          loop_optimize (insns, loop_dump_file);
  2945.            });
  2946.     }
  2947.  
  2948.   /* Dump rtl code after loop opt, if we are doing that.  */
  2949.  
  2950.   if (loop_dump)
  2951.     TIMEVAR (dump_time,
  2952.          {
  2953.            print_rtl (loop_dump_file, insns);
  2954.            fflush (loop_dump_file);
  2955.          });
  2956.  
  2957.   if (cse2_dump)
  2958.     TIMEVAR (dump_time,
  2959.          {
  2960.            fprintf (cse2_dump_file, "\n;; Function %s\n\n",
  2961.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2962.          });
  2963.  
  2964.   if (optimize > 0 && flag_rerun_cse_after_loop)
  2965.     {
  2966.       /* Running another jump optimization pass before the second
  2967.      cse pass sometimes simplifies the RTL enough to allow
  2968.      the second CSE pass to do a better job.  Jump_optimize can change
  2969.      max_reg_num so we must rerun reg_scan afterwards.
  2970.      ??? Rework to not call reg_scan so often.  */
  2971.       TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
  2972.       TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 1));
  2973.  
  2974.       TIMEVAR (cse2_time, reg_scan (insns, max_reg_num (), 0));
  2975.       TIMEVAR (cse2_time, tem = cse_main (insns, max_reg_num (),
  2976.                       1, cse2_dump_file));
  2977.       if (tem)
  2978.     TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
  2979.     }
  2980.  
  2981.   if (optimize > 0 && flag_thread_jumps)
  2982.     /* This pass of jump threading straightens out code
  2983.        that was kinked by loop optimization.  */
  2984.     TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 0));
  2985.  
  2986.   /* Dump rtl code after cse, if we are doing that.  */
  2987.  
  2988.   if (cse2_dump)
  2989.     TIMEVAR (dump_time,
  2990.          {
  2991.            print_rtl (cse2_dump_file, insns);
  2992.            fflush (cse2_dump_file);
  2993.          });
  2994.  
  2995.   /* We are no longer anticipating cse in this function, at least.  */
  2996.  
  2997.   cse_not_expected = 1;
  2998.  
  2999.   /* Now we choose between stupid (pcc-like) register allocation
  3000.      (if we got the -noreg switch and not -opt)
  3001.      and smart register allocation.  */
  3002.  
  3003.   if (optimize > 0)            /* Stupid allocation probably won't work */
  3004.     obey_regdecls = 0;        /* if optimizations being done.  */
  3005.  
  3006.   regclass_init ();
  3007.  
  3008.   /* Print function header into flow dump now
  3009.      because doing the flow analysis makes some of the dump.  */
  3010.  
  3011.   if (flow_dump)
  3012.     TIMEVAR (dump_time,
  3013.          {
  3014.            fprintf (flow_dump_file, "\n;; Function %s\n\n",
  3015.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  3016.          });
  3017.  
  3018.   if (obey_regdecls)
  3019.     {
  3020.       TIMEVAR (flow_time,
  3021.            {
  3022.          regclass (insns, max_reg_num ());
  3023.          stupid_life_analysis (insns, max_reg_num (),
  3024.                        flow_dump_file);
  3025.            });
  3026.     }
  3027.   else
  3028.     {
  3029.       /* Do control and data flow analysis,
  3030.      and write some of the results to dump file.  */
  3031.  
  3032.       TIMEVAR (flow_time, flow_analysis (insns, max_reg_num (),
  3033.                      flow_dump_file));
  3034.       if (warn_uninitialized)
  3035.     {
  3036.       uninitialized_vars_warning (DECL_INITIAL (decl));
  3037.       setjmp_args_warning ();
  3038.     }
  3039.     }
  3040.  
  3041.   /* Dump rtl after flow analysis.  */
  3042.  
  3043.   if (flow_dump)
  3044.     TIMEVAR (dump_time,
  3045.          {
  3046.            print_rtl (flow_dump_file, insns);
  3047.            fflush (flow_dump_file);
  3048.          });
  3049.  
  3050.   /* If -opt, try combining insns through substitution.  */
  3051.  
  3052.   if (optimize > 0)
  3053.     TIMEVAR (combine_time, combine_instructions (insns, max_reg_num ()));
  3054.  
  3055.   /* Dump rtl code after insn combination.  */
  3056.  
  3057.   if (combine_dump)
  3058.     TIMEVAR (dump_time,
  3059.          {
  3060.            fprintf (combine_dump_file, "\n;; Function %s\n\n",
  3061.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  3062.            dump_combine_stats (combine_dump_file);
  3063.            print_rtl (combine_dump_file, insns);
  3064.            fflush (combine_dump_file);
  3065.          });
  3066.  
  3067.   /* Print function header into sched dump now
  3068.      because doing the sched analysis makes some of the dump.  */
  3069.  
  3070.   if (sched_dump)
  3071.     TIMEVAR (dump_time,
  3072.          {
  3073.            fprintf (sched_dump_file, "\n;; Function %s\n\n",
  3074.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  3075.          });
  3076.  
  3077.   if (optimize > 0 && flag_schedule_insns)
  3078.     {
  3079.       /* Do control and data sched analysis,
  3080.      and write some of the results to dump file.  */
  3081.  
  3082.       TIMEVAR (sched_time, schedule_insns (sched_dump_file));
  3083.     }
  3084.  
  3085.   /* Dump rtl after instruction scheduling.  */
  3086.  
  3087.   if (sched_dump)
  3088.     TIMEVAR (dump_time,
  3089.          {
  3090.            print_rtl (sched_dump_file, insns);
  3091.            fflush (sched_dump_file);
  3092.          });
  3093.  
  3094.   /* Unless we did stupid register allocation,
  3095.      allocate pseudo-regs that are used only within 1 basic block.  */
  3096.  
  3097.   if (!obey_regdecls)
  3098.     TIMEVAR (local_alloc_time,
  3099.          {
  3100.            regclass (insns, max_reg_num ());
  3101.            local_alloc ();
  3102.          });
  3103.  
  3104.   /* Dump rtl code after allocating regs within basic blocks.  */
  3105.  
  3106.   if (local_reg_dump)
  3107.     TIMEVAR (dump_time,
  3108.          {
  3109.            fprintf (local_reg_dump_file, "\n;; Function %s\n\n",
  3110.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  3111.            dump_flow_info (local_reg_dump_file);
  3112.            dump_local_alloc (local_reg_dump_file);
  3113.            print_rtl (local_reg_dump_file, insns);
  3114.            fflush (local_reg_dump_file);
  3115.          });
  3116.  
  3117.   if (global_reg_dump)
  3118.     TIMEVAR (dump_time,
  3119.          fprintf (global_reg_dump_file, "\n;; Function %s\n\n",
  3120.               IDENTIFIER_POINTER (DECL_NAME (decl))));
  3121.  
  3122.   /* Unless we did stupid register allocation,
  3123.      allocate remaining pseudo-regs, then do the reload pass
  3124.      fixing up any insns that are invalid.  */
  3125.  
  3126.   TIMEVAR (global_alloc_time,
  3127.        {
  3128.          if (!obey_regdecls)
  3129.            failure = global_alloc (global_reg_dump_file);
  3130.          else
  3131.            failure = reload (insns, 0, global_reg_dump_file);
  3132.        });
  3133.  
  3134.   if (global_reg_dump)
  3135.     TIMEVAR (dump_time,
  3136.          {
  3137.            dump_global_regs (global_reg_dump_file);
  3138.            print_rtl (global_reg_dump_file, insns);
  3139.            fflush (global_reg_dump_file);
  3140.          });
  3141.  
  3142.   if (failure)
  3143.     goto exit_rest_of_compilation;
  3144.  
  3145.   reload_completed = 1;
  3146.  
  3147.   /* On some machines, the prologue and epilogue code, or parts thereof,
  3148.      can be represented as RTL.  Doing so lets us schedule insns between
  3149.      it and the rest of the code and also allows delayed branch
  3150.      scheduling to operate in the epilogue.  */
  3151.  
  3152.   thread_prologue_and_epilogue_insns (insns);
  3153.  
  3154.   if (optimize > 0 && flag_schedule_insns_after_reload)
  3155.     {
  3156.       if (sched2_dump)
  3157.     TIMEVAR (dump_time,
  3158.          {
  3159.            fprintf (sched2_dump_file, "\n;; Function %s\n\n",
  3160.                 IDENTIFIER_POINTER (DECL_NAME (decl)));
  3161.          });
  3162.  
  3163.       /* Do control and data sched analysis again,
  3164.      and write some more of the results to dump file.  */
  3165.  
  3166.       TIMEVAR (sched2_time, schedule_insns (sched2_dump_file));
  3167.  
  3168.       /* Dump rtl after post-reorder instruction scheduling.  */
  3169.  
  3170.       if (sched2_dump)
  3171.     TIMEVAR (dump_time,
  3172.          {
  3173.            print_rtl (sched2_dump_file, insns);
  3174.            fflush (sched2_dump_file);
  3175.          });
  3176.     }
  3177.  
  3178. #ifdef LEAF_REGISTERS
  3179.   leaf_function = 0;
  3180.   if (optimize > 0 && only_leaf_regs_used () && leaf_function_p ())
  3181.     leaf_function = 1;
  3182. #endif
  3183.  
  3184.   /* One more attempt to remove jumps to .+1
  3185.      left by dead-store-elimination.
  3186.      Also do cross-jumping this time
  3187.      and delete no-op move insns.  */
  3188.  
  3189.   if (optimize > 0)
  3190.     {
  3191.       TIMEVAR (jump_time, jump_optimize (insns, 1, 1, 0));
  3192.     }
  3193.  
  3194.   /* Dump rtl code after jump, if we are doing that.  */
  3195.  
  3196.   if (jump2_opt_dump)
  3197.     TIMEVAR (dump_time,
  3198.          {
  3199.            fprintf (jump2_opt_dump_file, "\n;; Function %s\n\n",
  3200.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  3201.            print_rtl (jump2_opt_dump_file, insns);
  3202.            fflush (jump2_opt_dump_file);
  3203.          });
  3204.  
  3205.   /* If a machine dependent reorganization is needed, call it.  */
  3206. #ifdef MACHINE_DEPENDENT_REORG
  3207.    MACHINE_DEPENDENT_REORG (insns);
  3208. #endif
  3209.  
  3210.   /* If a scheduling pass for delayed branches is to be done,
  3211.      call the scheduling code. */
  3212.  
  3213. #ifdef DELAY_SLOTS
  3214.   if (optimize > 0 && flag_delayed_branch)
  3215.     {
  3216.       TIMEVAR (dbr_sched_time, dbr_schedule (insns, dbr_sched_dump_file));
  3217.       if (dbr_sched_dump)
  3218.     {
  3219.       TIMEVAR (dump_time,
  3220.          {
  3221.            fprintf (dbr_sched_dump_file, "\n;; Function %s\n\n",
  3222.                 IDENTIFIER_POINTER (DECL_NAME (decl)));
  3223.            print_rtl (dbr_sched_dump_file, insns);
  3224.            fflush (dbr_sched_dump_file);
  3225.          });
  3226.     }
  3227.     }
  3228. #endif
  3229.  
  3230.   if (optimize > 0)
  3231.     /* Shorten branches.  */
  3232.     TIMEVAR (shorten_branch_time,
  3233.          {
  3234.            shorten_branches (get_insns ());
  3235.          });
  3236.  
  3237. #ifdef STACK_REGS
  3238.   TIMEVAR (stack_reg_time, reg_to_stack (insns, stack_reg_dump_file));
  3239.   if (stack_reg_dump)
  3240.     {
  3241.       TIMEVAR (dump_time,
  3242.            {
  3243.          fprintf (stack_reg_dump_file, "\n;; Function %s\n\n",
  3244.               IDENTIFIER_POINTER (DECL_NAME (decl)));
  3245.          print_rtl (stack_reg_dump_file, insns);
  3246.          fflush (stack_reg_dump_file);
  3247.            });
  3248.     }
  3249. #endif
  3250.  
  3251.   /* Now turn the rtl into assembler code.  */
  3252.  
  3253.   TIMEVAR (final_time,
  3254.        {
  3255.          rtx x;
  3256.          char *fnname;
  3257.  
  3258.          /* Get the function's name, as described by its RTL.
  3259.         This may be different from the DECL_NAME name used
  3260.         in the source file.  */
  3261.  
  3262.          x = DECL_RTL (decl);
  3263.          if (GET_CODE (x) != MEM)
  3264.            abort ();
  3265.          x = XEXP (x, 0);
  3266.          if (GET_CODE (x) != SYMBOL_REF)
  3267.            abort ();
  3268.          fnname = XSTR (x, 0);
  3269.  
  3270.          assemble_start_function (decl, fnname);
  3271.          final_start_function (insns, asm_out_file, optimize);
  3272.          final (insns, asm_out_file, optimize, 0);
  3273.          final_end_function (insns, asm_out_file, optimize);
  3274.          assemble_end_function (decl, fnname);
  3275.          fflush (asm_out_file);
  3276.        });
  3277.  
  3278.   /* Write DBX symbols if requested */
  3279.  
  3280.   /* Note that for those inline functions where we don't initially
  3281.      know for certain that we will be generating an out-of-line copy,
  3282.      the first invocation of this routine (rest_of_compilation) will
  3283.      skip over this code by doing a `goto exit_rest_of_compilation;'.
  3284.      Later on, finish_compilation will call rest_of_compilation again
  3285.      for those inline functions that need to have out-of-line copies
  3286.      generated.  During that call, we *will* be routed past here.  */
  3287.  
  3288. #ifdef DBX_DEBUGGING_INFO
  3289.   if (write_symbols == DBX_DEBUG)
  3290.     TIMEVAR (symout_time, dbxout_function (decl));
  3291. #endif
  3292.  
  3293. #ifdef DWARF_DEBUGGING_INFO
  3294.   if (write_symbols == DWARF_DEBUG)
  3295.     TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
  3296. #endif
  3297.  
  3298.  exit_rest_of_compilation:
  3299.  
  3300.   /* In case the function was not output,
  3301.      don't leave any temporary anonymous types
  3302.      queued up for sdb output.  */
  3303. #ifdef SDB_DEBUGGING_INFO
  3304.   if (write_symbols == SDB_DEBUG)
  3305.     sdbout_types (NULL_TREE);
  3306. #endif
  3307.  
  3308.   /* Put back the tree of subblocks and list of arguments
  3309.      from before we copied them.
  3310.      Code generation and the output of debugging info may have modified
  3311.      the copy, but the original is unchanged.  */
  3312.  
  3313.   if (saved_block_tree != 0)
  3314.     DECL_INITIAL (decl) = saved_block_tree;
  3315.   if (saved_arguments != 0)
  3316.     DECL_ARGUMENTS (decl) = saved_arguments;
  3317.  
  3318.   reload_completed = 0;
  3319.  
  3320.   /* Clear out the real_constant_chain before some of the rtx's
  3321.      it runs through become garbage.  */
  3322.  
  3323.   clear_const_double_mem ();
  3324.  
  3325.   /* Cancel the effect of rtl_in_current_obstack.  */
  3326.  
  3327.   resume_temporary_allocation ();
  3328.  
  3329.   /* The parsing time is all the time spent in yyparse
  3330.      *except* what is spent in this function.  */
  3331.  
  3332.   parse_time -= get_run_time () - start_time;
  3333. }
  3334.  
  3335. /* Entry point of cc1/c++.  Decode command args, then call compile_file.
  3336.    Exit code is 35 if can't open files, 34 if fatal error,
  3337.    33 if had nonfatal errors, else success.  */
  3338.  
  3339. int
  3340. main (argc, argv, envp)
  3341.      int argc;
  3342.      char **argv;
  3343.      char **envp;
  3344. {
  3345.   register int i;
  3346.   char *filename = 0;
  3347.   int flag_print_mem = 0;
  3348.   int version_flag = 0;
  3349.   char *p;
  3350.  
  3351.   /* save in case md file wants to emit args as a comment.  */
  3352.   save_argc = argc;
  3353.   save_argv = argv;
  3354.  
  3355.   p = argv[0] + strlen (argv[0]);
  3356.   while (p != argv[0] && p[-1] != '/') --p;
  3357.   progname = p;
  3358.  
  3359. #ifdef RLIMIT_STACK
  3360.   /* Get rid of any avoidable limit on stack size.  */
  3361.   {
  3362.     struct rlimit rlim;
  3363.  
  3364.     /* Set the stack limit huge so that alloca does not fail. */
  3365.     getrlimit (RLIMIT_STACK, &rlim);
  3366.     rlim.rlim_cur = rlim.rlim_max;
  3367.     setrlimit (RLIMIT_STACK, &rlim);
  3368.   }
  3369. #endif /* RLIMIT_STACK */
  3370.  
  3371.   signal (SIGFPE, float_signal);
  3372.  
  3373. #ifdef SIGPIPE
  3374.   signal (SIGPIPE, pipe_closed);
  3375. #endif
  3376.  
  3377.   decl_printable_name = decl_name;
  3378.   lang_expand_expr = (struct rtx_def *(*)()) do_abort;
  3379.   interim_eh_hook = interim_eh;
  3380.  
  3381.   /* Initialize whether `char' is signed.  */
  3382.   flag_signed_char = DEFAULT_SIGNED_CHAR;
  3383. #ifdef DEFAULT_SHORT_ENUMS
  3384.   /* Initialize how much space enums occupy, by default.  */
  3385.   flag_short_enums = DEFAULT_SHORT_ENUMS;
  3386. #endif
  3387.  
  3388.   /* Scan to see what optimization level has been specified.  That will
  3389.      determine the default value of many flags.  */
  3390.   for (i = 1; i < argc; i++)
  3391.     {
  3392.       if (!strcmp (argv[i], "-O"))
  3393.     {
  3394.       optimize = 1;
  3395.     }
  3396.       else if (argv[i][0] == '-' && argv[i][1] == 'O')
  3397.     {
  3398.       /* Handle -O2, -O3, -O69, ...  */
  3399.       char *p = &argv[i][2];
  3400.       int c;
  3401.  
  3402.       while (c = *p++)
  3403.         if (! (c >= '0' && c <= '9'))
  3404.           break;
  3405.       if (c == 0)
  3406.         optimize = atoi (&argv[i][2]);
  3407.     }
  3408.     }
  3409.  
  3410.   obey_regdecls = (optimize == 0);
  3411.   if (optimize == 0)
  3412.     {
  3413.       flag_no_inline = 1;
  3414.       warn_inline = 0;
  3415.     }
  3416.  
  3417.   if (optimize >= 1)
  3418.     {
  3419.       flag_defer_pop = 1;
  3420.       flag_thread_jumps = 1;
  3421. #ifdef DELAY_SLOTS
  3422.       flag_delayed_branch = 1;
  3423. #endif
  3424. #ifdef CAN_DEBUG_WITHOUT_FP
  3425.       flag_omit_frame_pointer = 1;
  3426. #endif
  3427.     }
  3428.  
  3429.   if (optimize >= 2)
  3430.     {
  3431.       flag_cse_follow_jumps = 1;
  3432.       flag_cse_skip_blocks = 1;
  3433.       flag_expensive_optimizations = 1;
  3434.       flag_strength_reduce = 1;
  3435.       flag_rerun_cse_after_loop = 1;
  3436.       flag_caller_saves = 1;
  3437. #ifdef INSN_SCHEDULING
  3438.       flag_schedule_insns = 1;
  3439.       flag_schedule_insns_after_reload = 1;
  3440. #endif
  3441.     }
  3442.  
  3443.   if (optimize >= 3)
  3444.     {
  3445.       flag_inline_functions = 1;
  3446.     }
  3447.  
  3448. #ifdef OPTIMIZATION_OPTIONS
  3449.   /* Allow default optimizations to be specified on a per-machine basis.  */
  3450.   OPTIMIZATION_OPTIONS (optimize);
  3451. #endif
  3452.  
  3453.   /* Initialize register usage now so switches may override.  */
  3454.   init_reg_sets ();
  3455.  
  3456.   target_flags = 0;
  3457.   set_target_switch ("");
  3458.  
  3459.   for (i = 1; i < argc; i++)
  3460.     {
  3461.       int j;
  3462.       /* If this is a language-specific option,
  3463.      decode it in a language-specific way.  */
  3464.       for (j = 0; lang_options[j] != 0; j++)
  3465.     if (!strncmp (argv[i], lang_options[j],
  3466.               strlen (lang_options[j])))
  3467.       break;
  3468.       if (lang_options[j] != 0)
  3469.     /* If the option is valid for *some* language,
  3470.        treat it as valid even if this language doesn't understand it.  */
  3471.     lang_decode_option (argv[i]);
  3472.       else if (argv[i][0] == '-' && argv[i][1] != 0)
  3473.     {
  3474.       register char *str = argv[i] + 1;
  3475.       if (str[0] == 'Y')
  3476.         str++;
  3477.  
  3478.       if (str[0] == 'm')
  3479.         set_target_switch (&str[1]);
  3480.       else if (!strcmp (str, "dumpbase"))
  3481.         {
  3482.           dump_base_name = argv[++i];
  3483.         }
  3484.       else if (str[0] == 'd')
  3485.         {
  3486.           register char *p = &str[1];
  3487.           while (*p)
  3488.         switch (*p++)
  3489.           {
  3490.            case 'a':
  3491.              combine_dump = 1;
  3492.              dbr_sched_dump = 1;
  3493.              flow_dump = 1;
  3494.              global_reg_dump = 1;
  3495.              jump_opt_dump = 1;
  3496.              jump2_opt_dump = 1;
  3497.              local_reg_dump = 1;
  3498.              loop_dump = 1;
  3499.              rtl_dump = 1;
  3500.              cse_dump = 1, cse2_dump = 1;
  3501.              sched_dump = 1;
  3502.              sched2_dump = 1;
  3503.             stack_reg_dump = 1;
  3504.             break;
  3505.           case 'k':
  3506.             stack_reg_dump = 1;
  3507.             break;
  3508.           case 'c':
  3509.             combine_dump = 1;
  3510.             break;
  3511.           case 'd':
  3512.             dbr_sched_dump = 1;
  3513.             break;
  3514.           case 'f':
  3515.             flow_dump = 1;
  3516.             break;
  3517.           case 'g':
  3518.             global_reg_dump = 1;
  3519.             break;
  3520.           case 'j':
  3521.             jump_opt_dump = 1;
  3522.             break;
  3523.           case 'J':
  3524.             jump2_opt_dump = 1;
  3525.             break;
  3526.           case 'l':
  3527.             local_reg_dump = 1;
  3528.             break;
  3529.           case 'L':
  3530.             loop_dump = 1;
  3531.             break;
  3532.           case 'm':
  3533.             flag_print_mem = 1;
  3534.             break;
  3535.           case 'p':
  3536.             flag_print_asm_name = 1;
  3537.             break;
  3538.           case 'r':
  3539.             rtl_dump = 1;
  3540.             break;
  3541.           case 's':
  3542.             cse_dump = 1;
  3543.             break;
  3544.           case 't':
  3545.             cse2_dump = 1;
  3546.             break;
  3547.           case 'S':
  3548.             sched_dump = 1;
  3549.             break;
  3550.           case 'R':
  3551.             sched2_dump = 1;
  3552.             break;
  3553.           case 'y':
  3554.             set_yydebug (1);
  3555.             break;
  3556.  
  3557.           case 'x':
  3558.             rtl_dump_and_exit = 1;
  3559.             break;
  3560.           }
  3561.         }
  3562.       else if (str[0] == 'f')
  3563.         {
  3564.           register char *p = &str[1];
  3565.           int found = 0;
  3566.  
  3567.           /* Some kind of -f option.
  3568.          P's value is the option sans `-f'.
  3569.          Search for it in the table of options.  */
  3570.  
  3571.           for (j = 0;
  3572.            !found && j < sizeof (f_options) / sizeof (f_options[0]);
  3573.            j++)
  3574.         {
  3575.           if (!strcmp (p, f_options[j].string))
  3576.             {
  3577.               *f_options[j].variable = f_options[j].on_value;
  3578.               /* A goto here would be cleaner,
  3579.              but breaks the vax pcc.  */
  3580.               found = 1;
  3581.             }
  3582.           if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
  3583.               && ! strcmp (p+3, f_options[j].string))
  3584.             {
  3585.               *f_options[j].variable = ! f_options[j].on_value;
  3586.               found = 1;
  3587.             }
  3588.         }
  3589.  
  3590.           if (found)
  3591.         ;
  3592.           else if (!strncmp (p, "fixed-", 6))
  3593.         fix_register (&p[6], 1, 1);
  3594.           else if (!strncmp (p, "call-used-", 10))
  3595.         fix_register (&p[10], 0, 1);
  3596.           else if (!strncmp (p, "call-saved-", 11))
  3597.         fix_register (&p[11], 0, 0);
  3598.           else
  3599.         error ("Invalid option `%s'", argv[i]);
  3600.         }
  3601.       else if (str[0] == 'O')
  3602.         {
  3603.           register char *p = str+1;
  3604.           while (*p && *p >= '0' && *p <= '9')
  3605.         p++;
  3606.           if (*p == '\0')
  3607.         ;
  3608.           else
  3609.         error ("Invalid option `%s'", argv[i]);
  3610.         }
  3611.       else if (!strcmp (str, "pedantic"))
  3612.         pedantic = 1;
  3613.       else if (!strcmp (str, "pedantic-errors"))
  3614.         flag_pedantic_errors = pedantic = 1;
  3615.       else if (!strcmp (str, "quiet"))
  3616.         quiet_flag = 1;
  3617.       else if (!strcmp (str, "version"))
  3618.         version_flag = 1;
  3619.       else if (!strcmp (str, "w"))
  3620.         inhibit_warnings = 1;
  3621.       else if (!strcmp (str, "W"))
  3622.         {
  3623.           extra_warnings = 1;
  3624.           /* We save the value of warn_uninitialized, since if they put
  3625.          -Wuninitialized on the command line, we need to generate a
  3626.          warning about not using it without also specifying -O.  */
  3627.           if (warn_uninitialized != 1)
  3628.         warn_uninitialized = 2;
  3629.         }
  3630.       else if (str[0] == 'W')
  3631.         {
  3632.           register char *p = &str[1];
  3633.           int found = 0;
  3634.  
  3635.           /* Some kind of -W option.
  3636.          P's value is the option sans `-W'.
  3637.          Search for it in the table of options.  */
  3638.  
  3639.           for (j = 0;
  3640.            !found && j < sizeof (W_options) / sizeof (W_options[0]);
  3641.            j++)
  3642.         {
  3643.           if (!strcmp (p, W_options[j].string))
  3644.             {
  3645.               *W_options[j].variable = W_options[j].on_value;
  3646.               /* A goto here would be cleaner,
  3647.              but breaks the vax pcc.  */
  3648.               found = 1;
  3649.             }
  3650.           if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
  3651.               && ! strcmp (p+3, W_options[j].string))
  3652.             {
  3653.               *W_options[j].variable = ! W_options[j].on_value;
  3654.               found = 1;
  3655.             }
  3656.         }
  3657.  
  3658.           if (found)
  3659.         ;
  3660.           else if (!strncmp (p, "id-clash-", 9))
  3661.         {
  3662.           char *endp = p + 9;
  3663.  
  3664.           while (*endp)
  3665.             {
  3666.               if (*endp >= '0' && *endp <= '9')
  3667.             endp++;
  3668.               else
  3669.             {
  3670.               error ("Invalid option `%s'", argv[i]);
  3671.               goto id_clash_lose;
  3672.             }
  3673.             }
  3674.           warn_id_clash = 1;
  3675.           id_clash_len = atoi (str + 10);
  3676.         id_clash_lose: ;
  3677.         }
  3678.           else if (!strncmp (p, "larger-than-", 12))
  3679.         {
  3680.           char *endp = p + 12;
  3681.  
  3682.           while (*endp)
  3683.             {
  3684.               if (*endp >= '0' && *endp <= '9')
  3685.             endp++;
  3686.               else
  3687.             {
  3688.               error ("Invalid option `%s'", argv[i]);
  3689.               goto larger_than_lose;
  3690.             }
  3691.             }
  3692.           warn_larger_than = 1;
  3693.           larger_than_size = atoi (str + 13);
  3694.         larger_than_lose: ;
  3695.         }
  3696.           else
  3697.         error ("Invalid option `%s'", argv[i]);
  3698.         }
  3699.       else if (!strcmp (str, "p"))
  3700.         {
  3701.           if (!output_bytecode)
  3702.         profile_flag = 1;
  3703.           else
  3704.         error ("profiling not supported in bytecode compilation");
  3705.         }
  3706.       else if (!strcmp (str, "a"))
  3707.         {
  3708. #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
  3709.           warning ("`-a' option (basic block profile) not supported");
  3710. #else
  3711.           profile_block_flag = 1;
  3712. #endif
  3713.         }
  3714.       else if (str[0] == 'g')
  3715.         {
  3716.           char *p = str + 1;
  3717.           char *q;
  3718.           unsigned len;
  3719.           unsigned level;
  3720.  
  3721.           while (*p && (*p < '0' || *p > '9'))
  3722.         p++;
  3723.           len = p - str;
  3724.           q = p;
  3725.           while (*q && (*q >= '0' && *q <= '9'))
  3726.         q++;
  3727.           if (*p)
  3728.         level = atoi (p);
  3729.           else
  3730.         level = 2;    /* default debugging info level */
  3731.           if (*q || level > 3)
  3732.         {
  3733.           warning ("invalid debug level specification in option: `-%s'",
  3734.                str);
  3735.           warning ("no debugging information will be generated");
  3736.           level = 0;
  3737.         }
  3738.  
  3739.           /* If more than one debugging type is supported,
  3740.          you must define PREFERRED_DEBUGGING_TYPE
  3741.          to choose a format in a system-dependent way.  */
  3742.           /* This is one long line cause VAXC can't handle a \-newline.  */
  3743. #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
  3744. #ifdef PREFERRED_DEBUGGING_TYPE
  3745.           if (!strncmp (str, "ggdb", len))
  3746.         write_symbols = PREFERRED_DEBUGGING_TYPE;
  3747. #else /* no PREFERRED_DEBUGGING_TYPE */
  3748. You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
  3749. #endif /* no PREFERRED_DEBUGGING_TYPE */
  3750. #endif /* More than one debugger format enabled.  */
  3751. #ifdef DBX_DEBUGGING_INFO
  3752.           if (write_symbols != NO_DEBUG)
  3753.         ;
  3754.           else if (!strncmp (str, "ggdb", len))
  3755.         write_symbols = DBX_DEBUG;
  3756.           else if (!strncmp (str, "gstabs", len))
  3757.         write_symbols = DBX_DEBUG;
  3758.           else if (!strncmp (str, "gstabs+", len))
  3759.         write_symbols = DBX_DEBUG;
  3760.  
  3761.           /* Always enable extensions for -ggdb or -gstabs+, 
  3762.          always disable for -gstabs.
  3763.          For plain -g, use system-specific default.  */
  3764.           if (write_symbols == DBX_DEBUG && !strncmp (str, "ggdb", len)
  3765.           && len >= 2)
  3766.         use_gnu_debug_info_extensions = 1;
  3767.           else if (write_symbols == DBX_DEBUG && !strncmp (str, "gstabs+", len)
  3768.                && len >= 7)
  3769.         use_gnu_debug_info_extensions = 1;
  3770.           else if (write_symbols == DBX_DEBUG
  3771.                && !strncmp (str, "gstabs", len) && len >= 2)
  3772.         use_gnu_debug_info_extensions = 0;
  3773.           else
  3774.         use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
  3775. #endif /* DBX_DEBUGGING_INFO */
  3776. #ifdef DWARF_DEBUGGING_INFO
  3777.           if (write_symbols != NO_DEBUG)
  3778.         ;
  3779.           else if (!strncmp (str, "g", len))
  3780.         write_symbols = DWARF_DEBUG;
  3781.           else if (!strncmp (str, "ggdb", len))
  3782.         write_symbols = DWARF_DEBUG;
  3783.           else if (!strncmp (str, "gdwarf", len))
  3784.         write_symbols = DWARF_DEBUG;
  3785.  
  3786.           /* Always enable extensions for -ggdb or -gdwarf+, 
  3787.          always disable for -gdwarf.
  3788.          For plain -g, use system-specific default.  */
  3789.           if (write_symbols == DWARF_DEBUG && !strncmp (str, "ggdb", len)
  3790.           && len >= 2)
  3791.         use_gnu_debug_info_extensions = 1;
  3792.           else if (write_symbols == DWARF_DEBUG && !strcmp (str, "gdwarf+"))
  3793.         use_gnu_debug_info_extensions = 1;
  3794.           else if (write_symbols == DWARF_DEBUG
  3795.                && !strncmp (str, "gdwarf", len) && len >= 2)
  3796.         use_gnu_debug_info_extensions = 0;
  3797.           else
  3798.         use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
  3799. #endif
  3800. #ifdef SDB_DEBUGGING_INFO
  3801.           if (write_symbols != NO_DEBUG)
  3802.         ;
  3803.           else if (!strncmp (str, "g", len))
  3804.         write_symbols = SDB_DEBUG;
  3805.           else if (!strncmp (str, "gdb", len))
  3806.         write_symbols = SDB_DEBUG;
  3807.           else if (!strncmp (str, "gcoff", len))
  3808.         write_symbols = SDB_DEBUG;
  3809. #endif /* SDB_DEBUGGING_INFO */
  3810. #ifdef XCOFF_DEBUGGING_INFO
  3811.           if (write_symbols != NO_DEBUG)
  3812.         ;
  3813.           else if (!strncmp (str, "g", len))
  3814.         write_symbols = XCOFF_DEBUG;
  3815.           else if (!strncmp (str, "ggdb", len))
  3816.         write_symbols = XCOFF_DEBUG;
  3817.           else if (!strncmp (str, "gxcoff", len))
  3818.         write_symbols = XCOFF_DEBUG;
  3819.  
  3820.           /* Always enable extensions for -ggdb or -gxcoff+,
  3821.          always disable for -gxcoff.
  3822.          For plain -g, use system-specific default.  */
  3823.           if (write_symbols == XCOFF_DEBUG && !strncmp (str, "ggdb", len)
  3824.           && len >= 2)
  3825.         use_gnu_debug_info_extensions = 1;
  3826.           else if (write_symbols == XCOFF_DEBUG && !strcmp (str, "gxcoff+"))
  3827.         use_gnu_debug_info_extensions = 1;
  3828.           else if (write_symbols == XCOFF_DEBUG
  3829.                && !strncmp (str, "gxcoff", len) && len >= 2)
  3830.         use_gnu_debug_info_extensions = 0;
  3831.           else
  3832.         use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
  3833. #endif          
  3834.           if (write_symbols == NO_DEBUG)
  3835.         warning ("`-%s' option not supported on this version of GCC", str);
  3836.           else if (level == 0)
  3837.         write_symbols = NO_DEBUG;
  3838.           else
  3839.         debug_info_level = (enum debug_info_level) level;
  3840.         }
  3841.       else if (!strcmp (str, "o"))
  3842.         {
  3843.           asm_file_name = argv[++i];
  3844.         }
  3845.       else if (str[0] == 'G')
  3846.         {
  3847.           g_switch_set = TRUE;
  3848.           g_switch_value = atoi ((str[1] != '\0') ? str+1 : argv[++i]);
  3849.         }
  3850.       else if (!strncmp (str, "aux-info", 8))
  3851.         {
  3852.           flag_gen_aux_info = 1;
  3853.           aux_info_file_name = (str[8] != '\0' ? str+8 : argv[++i]);
  3854.         }
  3855.       else
  3856.         error ("Invalid option `%s'", argv[i]);
  3857.     }
  3858.       else if (argv[i][0] == '+')
  3859.     error ("Invalid option `%s'", argv[i]);
  3860.       else
  3861.     filename = argv[i];
  3862.     }
  3863.  
  3864.   /* Initialize for bytecode output.  A good idea to do this as soon as
  3865.      possible after the "-f" options have been parsed. */
  3866.   if (output_bytecode)
  3867.     {
  3868. #ifndef TARGET_SUPPORTS_BYTECODE
  3869.       /* Just die with a fatal error if not supported */
  3870.       fatal ("-fbytecode not supporter for this target");
  3871. #else
  3872.       bc_initialize ();
  3873. #endif
  3874.     }
  3875.  
  3876.   if (optimize == 0)
  3877.     {
  3878.       /* Inlining does not work if not optimizing,
  3879.      so force it not to be done.  */
  3880.       flag_no_inline = 1;
  3881.       warn_inline = 0;
  3882.  
  3883.       /* The c_decode_option and lang_decode_option functions set
  3884.      this to `2' if -Wall is used, so we can avoid giving out
  3885.      lots of errors for people who don't realize what -Wall does.  */
  3886.       if (warn_uninitialized == 1)
  3887.     warning ("-Wuninitialized is not supported without -O");
  3888.     }
  3889.  
  3890. #if defined(DWARF_DEBUGGING_INFO)
  3891.   if (write_symbols == DWARF_DEBUG
  3892.       && strcmp (language_string, "GNU C++") == 0)
  3893.     {
  3894.       warning ("-g option not supported for C++ on SVR4 systems");
  3895.       write_symbols = NO_DEBUG;
  3896.     }
  3897. #endif /* defined(DWARF_DEBUGGING_INFO) */
  3898.  
  3899. #ifdef OVERRIDE_OPTIONS
  3900.   /* Some machines may reject certain combinations of options.  */
  3901.   OVERRIDE_OPTIONS;
  3902. #endif
  3903.  
  3904.   /* Unrolling all loops implies that standard loop unrolling must also
  3905.      be done.  */
  3906.   if (flag_unroll_all_loops)
  3907.     flag_unroll_loops = 1;
  3908.   /* Loop unrolling requires that strength_reduction be on also.  Silently
  3909.      turn on strength reduction here if it isn't already on.  Also, the loop
  3910.      unrolling code assumes that cse will be run after loop, so that must
  3911.      be turned on also.  */
  3912.   if (flag_unroll_loops)
  3913.     {
  3914.       flag_strength_reduce = 1;
  3915.       flag_rerun_cse_after_loop = 1;
  3916.     }
  3917.  
  3918.   /* Warn about options that are not supported on this machine.  */
  3919. #ifndef INSN_SCHEDULING
  3920.   if (flag_schedule_insns || flag_schedule_insns_after_reload)
  3921.     warning ("instruction scheduling not supported on this target machine");
  3922. #endif
  3923. #ifndef DELAY_SLOTS
  3924.   if (flag_delayed_branch)
  3925.     warning ("this target machine does not have delayed branches");
  3926. #endif
  3927.  
  3928.   /* If we are in verbose mode, write out the version and maybe all the
  3929.      option flags in use.  */
  3930.   if (version_flag)
  3931.     {
  3932.       fprintf (stderr, "%s version %s", language_string, version_string);
  3933. #ifdef TARGET_VERSION
  3934.       TARGET_VERSION;
  3935. #endif
  3936. #ifdef __GNUC__
  3937. #ifndef __VERSION__
  3938. #define __VERSION__ "[unknown]"
  3939. #endif
  3940.       fprintf (stderr, " compiled by GNU C version %s.\n", __VERSION__);
  3941. #else
  3942.       fprintf (stderr, " compiled by CC.\n");
  3943. #endif
  3944.       if (! quiet_flag)
  3945.     print_switch_values ();
  3946.     }
  3947.  
  3948.   compile_file (filename);
  3949.  
  3950. #if !defined(OS2) && !defined(VMS) && !defined(WINNT)
  3951.   if (flag_print_mem)
  3952.     {
  3953. #ifdef __alpha
  3954.       char *sbrk ();
  3955. #endif
  3956.       char *lim = (char *) sbrk (0);
  3957.  
  3958.       fprintf (stderr, "Data size %d.\n",
  3959.            lim - (char *) &environ);
  3960.       fflush (stderr);
  3961.  
  3962. #ifdef USG
  3963.       system ("ps -l 1>&2");
  3964. #else /* not USG */
  3965.       system ("ps v");
  3966. #endif /* not USG */
  3967.     }
  3968. #endif /* not OS2 and not VMS and not WINNT */
  3969.  
  3970.   if (errorcount)
  3971.     exit (FATAL_EXIT_CODE);
  3972.   if (sorrycount)
  3973.     exit (FATAL_EXIT_CODE);
  3974.   exit (SUCCESS_EXIT_CODE);
  3975.   return 34;
  3976. }
  3977.  
  3978. /* Decode -m switches.  */
  3979.  
  3980. /* Here is a table, controlled by the tm.h file, listing each -m switch
  3981.    and which bits in `target_switches' it should set or clear.
  3982.    If VALUE is positive, it is bits to set.
  3983.    If VALUE is negative, -VALUE is bits to clear.
  3984.    (The sign bit is not used so there is no confusion.)  */
  3985.  
  3986. struct {char *name; int value;} target_switches []
  3987.   = TARGET_SWITCHES;
  3988.  
  3989. /* This table is similar, but allows the switch to have a value.  */
  3990.  
  3991. #ifdef TARGET_OPTIONS
  3992. struct {char *prefix; char ** variable;} target_options []
  3993.   = TARGET_OPTIONS;
  3994. #endif
  3995.  
  3996. /* Decode the switch -mNAME.  */
  3997.  
  3998. void
  3999. set_target_switch (name)
  4000.      char *name;
  4001. {
  4002.   register int j;
  4003.   int valid = 0;
  4004.  
  4005.   for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
  4006.     if (!strcmp (target_switches[j].name, name))
  4007.       {
  4008.     if (target_switches[j].value < 0)
  4009.       target_flags &= ~-target_switches[j].value;
  4010.     else
  4011.       target_flags |= target_switches[j].value;
  4012.     valid = 1;
  4013.       }
  4014.  
  4015. #ifdef TARGET_OPTIONS
  4016.   if (!valid)
  4017.     for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
  4018.       {
  4019.     int len = strlen (target_options[j].prefix);
  4020.     if (!strncmp (target_options[j].prefix, name, len))
  4021.       {
  4022.         *target_options[j].variable = name + len;
  4023.         valid = 1;
  4024.       }
  4025.       }
  4026. #endif
  4027.  
  4028.   if (!valid)
  4029.     error ("Invalid option `%s'", name);
  4030. }
  4031.  
  4032. /* Variable used for communication between the following two routines.  */
  4033.  
  4034. static int line_position;
  4035.  
  4036. /* Print an option value and adjust the position in the line.  */
  4037.  
  4038. static void
  4039. print_single_switch (type, name)
  4040.      char *type, *name;
  4041. {
  4042.   fprintf (stderr, " %s%s", type, name);
  4043.  
  4044.   line_position += strlen (type) + strlen (name) + 1;
  4045.  
  4046.   if (line_position > 65)
  4047.     {
  4048.       fprintf (stderr, "\n\t");
  4049.       line_position = 8;
  4050.     }
  4051. }
  4052.      
  4053. /* Print default target switches for -version.  */
  4054.  
  4055. static void
  4056. print_switch_values ()
  4057. {
  4058.   register int j;
  4059.  
  4060.   fprintf (stderr, "enabled:");
  4061.   line_position = 8;
  4062.  
  4063.   for (j = 0; j < sizeof f_options / sizeof f_options[0]; j++)
  4064.     if (*f_options[j].variable == f_options[j].on_value)
  4065.       print_single_switch ("-f", f_options[j].string);
  4066.  
  4067.   for (j = 0; j < sizeof W_options / sizeof W_options[0]; j++)
  4068.     if (*W_options[j].variable == W_options[j].on_value)
  4069.       print_single_switch ("-W", W_options[j].string);
  4070.  
  4071.   for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
  4072.     if (target_switches[j].name[0] != '\0'
  4073.     && target_switches[j].value > 0
  4074.     && ((target_switches[j].value & target_flags)
  4075.         == target_switches[j].value))
  4076.       print_single_switch ("-m", target_switches[j].name);
  4077.  
  4078.   fprintf (stderr, "\n");
  4079. }
  4080.